Hi
I'm trying to implement the monome protocol on the arduino, but I have some trouble figuring how to translate those C commands into the Arduino IDE. the monomeserial recognize my board as a 40h after I changed the FTDI chip ID, but I can't (yet) use it as a monome.
The messagePackButtonPress function is used to send serial data :
void messagePackButtonPress(t_message *message, uint8 state, uint8 x, uint8 y)
{
message->data0 = (kMessageTypeButtonPress << 4) | (state ? on : off);
message->data1 = (x << 4) | y;
}
t_message is defined as follow
typedef struct {
uint8 data0;
uint8 data1;
} t_message;
You can find the protocol specifications here : http://docs.monome.org/doku.php?id=tech:protocol:40h & http://docs.monome.org/doku.php?id=tech:protocol:serial:series
I know that each data to send (adress, state, xpos, ypos) must be 4 bits long, but what I don't understand is the message->data0 & message->data1 syntax. I tried
Serial.print(0x0000 | 0x0000);
Serial.print(0x0000 | 0x0000);
But I must have some bit shifting of variable type problem (I'm really bad with all this binary stuff ^^)
How to translate in "Arduino style"? Thanks