Go to advanced search

by PeterO
Sun Feb 25, 2018 8:04 am
Forum: Graphics programming
Topic: Which OpenGL
Replies: 3
Views: 84

Re: Which OpenGL

If you want well supported (ie not beta quality) then I would go for openGLESv2. If at a later date you move to full openGL then there won't be too many things to change.

PeterO
by PeterO
Sat Feb 24, 2018 8:39 am
Forum: C/C++
Topic: ALSA Programming
Replies: 4
Views: 138

Re: ALSA Programming

You could also have done it by changing SND_PCM_FORMAT_ U8 to SND_PCM_FORMAT_ S8 and int tempint = 255 * sin ( baseVal [ keyPlaying ] * keyPos ); to int tempint = 127 * sin ( baseVal [ keyPlaying ] * keyPos ); BUT ISTR that might depend on the sound device having to support signed samples (and not a...
by PeterO
Sat Feb 24, 2018 8:18 am
Forum: C/C++
Topic: ALSA Programming
Replies: 4
Views: 138

Re: ALSA Programming

LdB wrote:
Sat Feb 24, 2018 2:28 am
I am going to make a suggestion you google stdint.h the C/C++ defined bit length unit
using int16_t makes life a whole lot easier
I will modify your code to use stdint.h and it will then look exactly like the 8 bit code
+1
PeterO
by PeterO
Fri Feb 23, 2018 7:52 pm
Forum: Raspbian
Topic: Raspbian Pixel: Whats the Name of the "CPU Usage"
Replies: 7
Views: 193

Re: Raspbian Pixel: Whats the Name of the "CPU Usage"

u mean Lubuntu? There are no Options on context menu, see screenshot https://abload.de/img/cpulast36zpqu.jpg This is the Raspberry Pi web site, and this is the Raspbian forum. If you ask questions it will be assumed you are asking about Raspbian. If you have questions about ubuntu you should find a...
by PeterO
Fri Feb 23, 2018 5:45 pm
Forum: Raspbian
Topic: Raspbian Pixel: Whats the Name of the "CPU Usage"
Replies: 7
Views: 193

Re: Raspbian Pixel: Whats the Name of the "CPU Usage"

If you havn't already found it, you can right click on the plugin to configure foreground and background colours and turn % display on and off.
PeterO
by PeterO
Fri Feb 23, 2018 5:22 pm
Forum: C/C++
Topic: negative number in C++ code is giving problems
Replies: 15
Views: 301

Re: negative number in C++ code is giving problems

LdB wrote:
Fri Feb 23, 2018 4:59 pm
The problem is obvious and it has nothing to do with the negative .... R & C are integers or longints
Read the first post in the thread ...
R and C are global constants (double), 220 and 1 respectively.
PeterO
by PeterO
Fri Feb 23, 2018 9:10 am
Forum: General discussion
Topic: Python Indentation
Replies: 6
Views: 258

Re: Python Indentation

Herlambang_Rizky wrote:
Fri Feb 23, 2018 8:58 am
cause its global variable, so it must be different level from other line i think ? cmiiw.
yw ! :lol:

PeterO
by PeterO
Thu Feb 22, 2018 8:56 am
Forum: C/C++
Topic: negative number in C++ code is giving problems
Replies: 15
Views: 301

Re: negative number in C++ code is giving problems

Very odd !

Please post a complete example program that demonstrates this behaviour because I think there must be something else going on to cause this and without seeing all of your code it is impossible to tell what is causing this strange behaviour.

PeterO
by PeterO
Mon Feb 19, 2018 2:56 pm
Forum: Python
Topic: Infinite loop malfunction
Replies: 15
Views: 347

Re: Infinite loop malfunction

Just a thought.... Is there any logging on the broker that can show how many messages have been handled ?
PeterO
by PeterO
Mon Feb 19, 2018 1:37 pm
Forum: Python
Topic: Infinite loop malfunction
Replies: 15
Views: 347

Re: Infinite loop malfunction

OK, I think you need an mqtt expert now .... PeterO So in other words you do not see anything wrong with my python script? NO,I'm saying I don't know enough about mqtt to know if there is a problem there. My first guess was that your message source was sending multiple messages but you seem to have...
by PeterO
Mon Feb 19, 2018 11:19 am
Forum: Python
Topic: Infinite loop malfunction
Replies: 15
Views: 347

Re: Infinite loop malfunction

OK, I think you need an mqtt expert now ....
PeterO
by PeterO
Mon Feb 19, 2018 10:13 am
Forum: Python
Topic: Infinite loop malfunction
Replies: 15
Views: 347

Re: Infinite loop malfunction

Is it just the sound that repeats, or does the "Topic" message get printed multiple times as well ? PeterO Topic message gets printed multiple times as well. Which suggests it is receiving multiple messages. Are you sure the "other end" is only sending one message ? (Note I know noting about mqtt s...
by PeterO
Mon Feb 19, 2018 9:08 am
Forum: General discussion
Topic: How do I calculate servo current draws
Replies: 5
Views: 194

Re: How do I calculate servo current draws

Also the peak current while moving will be higher than steady current while still and will depend on how fast you try to move the servo. You will probably need an oscilloscope of some form to catch the transient current pulse as they will be too short (100s of mS maybe) to see on a meter. PeterO St...
by PeterO
Mon Feb 19, 2018 8:40 am
Forum: Python
Topic: Infinite loop malfunction
Replies: 15
Views: 347

Re: Infinite loop malfunction

Is it just the sound that repeats, or does the "Topic" message get printed multiple times as well ?

PeterO
by PeterO
Mon Feb 19, 2018 8:34 am
Forum: General discussion
Topic: How do I calculate servo current draws
Replies: 5
Views: 194

Re: How do I calculate servo current draws

Also the peak current while moving will be higher than steady current while still and will depend on how fast you try to move the servo.
You will probably need an oscilloscope of some form to catch the transient current pulse as they will be too short (100s of mS maybe) to see on a meter.


PeterO
by PeterO
Sun Feb 18, 2018 11:41 pm
Forum: Advanced users
Topic: Booting from usb advice needed
Replies: 34
Views: 1070

Re: Booting from usb advice needed

Does a kernal update happen during a sudo apt-get upgrade? or only through a raspi-update? apt is the recommended way to get stable updates for the OS, kernel and bootloader files. raspi-update will get you the latest kernel, bootloader and RPF produced OS files but it might break things. The OS an...
by PeterO
Sun Feb 18, 2018 10:26 am
Forum: C/C++
Topic: Sampling Loop coded in C is inaccurate
Replies: 26
Views: 812

Re: Sampling Loop coded in C is inaccurate

J.Bryan wrote:
Sun Feb 18, 2018 9:35 am
I am able to read my sensor data using spi,
:roll: So your actual problem is how to read SPI data at a predictable interval.... Maybe start a thread with that as the title and see of you get any answers to your actual problem this time.
PeterO
by PeterO
Sun Feb 18, 2018 9:00 am
Forum: C/C++
Topic: Sampling Loop coded in C is inaccurate
Replies: 26
Views: 812

Re: Sampling Loop coded in C is inaccurate

Heater wrote:
Sun Feb 18, 2018 8:16 am
It's not clear to me how pigpio would get rid of the milliseconds of hiccups the OP experiences without also taking other measures as indicated above.
it does it by making use of the available hardware !
PeterO
by PeterO
Sun Feb 18, 2018 8:50 am
Forum: C/C++
Topic: Sampling Loop coded in C is inaccurate
Replies: 26
Views: 812

Re: Sampling Loop coded in C is inaccurate

The simplest fix is to use pigpio alerts. I suggest you run http://abyz.me.uk/rpi/pigpio/examples.html#Python_monitor_py from the command line for half an hour or so. If it isn't several orders of magnitude more accurate than you currently have I'll give you your money back. FYI J.Bryan, Joan is th...
by PeterO
Sun Feb 18, 2018 8:13 am
Forum: Advanced users
Topic: Booting from usb advice needed
Replies: 34
Views: 1070

Re: Booting from usb advice needed

n67 wrote:
Sat Feb 17, 2018 11:38 pm
Now with the semantics out the way, on to the issue at hand :-)
For some of the posters here, it is all about semantics.
It's all about the semantics because if you want the right answer to your problem you have to ask the right question !
PeterO
by PeterO
Sat Feb 17, 2018 11:18 pm
Forum: Advanced users
Topic: Booting from usb advice needed
Replies: 34
Views: 1070

Re: Booting from usb advice needed

PeterO - As I stated in my initial post, from the beginning I was trying to boot a RPI2 from usb. I'd have thought it was pretty much a given that I'm using an SD card initially, as only the Pi3 can use USB device as a primary boot device. So, if you knew that, why did you use a misleading thread t...
by PeterO
Sat Feb 17, 2018 9:25 pm
Forum: Advanced users
Topic: Booting from usb advice needed
Replies: 34
Views: 1070

Re: Booting from usb advice needed

[ @PeterO, I think you are missing two things: The OP talks about Booting from USB is easy on a Pi1, Pi2, or Pi3 which implies inuitial booting from SDCard and transferring to the USB system during the boot process PARTUUID allows correct selection of the expected USB mass storage device even if mo...
by PeterO
Fri Feb 16, 2018 7:28 pm
Forum: General discussion
Topic: Convert Short to a 2's complement char help needed in C
Replies: 30
Views: 932

Re: Convert Short to a 2's complement char help needed in C

gcc on my pi says ... pi@raspberrypi:/tmp $ gcc --version gcc (Raspbian 6.3.0-18+rpi1) 6.3.0 20170516 l.c: In function ‘main’: l.c:16:15: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘ptrdiff_t {aka int}’ [-Wformat=] printf("%ld\n", l); ^ The printf manual page ...
by PeterO
Fri Feb 16, 2018 6:35 pm
Forum: General discussion
Topic: Convert Short to a 2's complement char help needed in C
Replies: 30
Views: 932

Re: Convert Short to a 2's complement char help needed in C

c.c:5:5: warning: function declaration isn’t a prototype [-Wstrict-prototypes] int main() { ^~~~ c.c: In function ‘main’: c.c:8:16: warning: conversion to ‘int16_t {aka short int}’ from ‘int’ may alter its value [-Wconversion] int16_t sm = -s; // The negative of the above ^ c.c:10:15: warning: conve...

Go to advanced search