bitwise operators

Hey a question for those that are more familiar with c++ than i.

Im trying to convert this code and expand it so i can use 4 sensors instead of 1.

Currently the code is (works perfectly as is)…

unsigned char val1;
unsigned char val2;

//gnarly code to turn the int into two bytes

val1 = value &0xFF;
val2 = (value >> 8) &0xFF;

//send both bytes
Serial.print(val1, BYTE);
Serial.print(val2, BYTE);

and then in on the other end (openFrameWorks) it’s converted back to…

sensor_01 = ( (unsigned char)bytesReadString[1] << 8 | (unsigned char)bytesReadString[0] );

I found a really helpful post on this issue, but at my current level it is above me… (hopefully not for long =D )

Any help would be greatly appreciated, thanks!

You'll have to expand your description a bit. For example: Are you having problems on the Arduino side or the openFrameWorks side?

unsigned char MSB;
unsigned char LSB;

//not-so gnarly code to turn the int into two bytes  
LSB = lowByte (value);
MSB = highByte (value);

http://arduino.cc/en/Reference/LowByte