first user Hello guys!
So I hope someone can help .. My php background therefore introduces the word lowend, for example, char are bytes that are bits .. which are binary values ββ.. etc. It takes some time to get stuck;)
What I'm trying to do here sends some values ββfrom the Ardunio board to openFrameWorks (both are C ++).
That this script is currently working (and works well for one sensor, which I can add) when asked that the data will be sent ..
int value_01 = analogRead(0); // which outputs between 0-1024 unsigned char val1; unsigned char val2; //some Complicated bitshift operation val1 = value_01 &0xFF; val2 = (value_01 >> 8) &0xFF; //send both bytes Serial.print(val1, BYTE); Serial.print(val2, BYTE);
This is apparently the most reliable way to get data through. So, now when it is sent via the serial port, bytes are added to the char string and converted back ..
int num = ( (unsigned char)bytesReadString[1] << 8 | (unsigned char)bytesReadString[0] );
So, to understand, I'm trying to get 4 data values ββwith sensors (which, suppose, will be 8 of these consecutive graphs?) And have int num_01 - num_04 ... at the end of everything.
I suggest that this (like most things) can be quite easy for someone who has experience in these concepts.
Any help would be greatly appreciated. Thanks
c ++ bit-manipulation arduino openframeworks
aKiwi
source share