Hi all,
I make a project that used 4 transmit modules with a accelerometer and 1 receiver module that received all the data from the accelerometers. I try first odf course that this is going with one transmitter module.
But there is a problem with the receiver, I use this code at the transmitter:
payload.id = id;
payload.teller[0] = highByte(teller);
payload.teller[1] = lowByte(teller);
payload.accxg[0] = highByte(accxg);
payload.accxg[1] = lowByte(accxg); /
payload.accyg[0] = highByte(accyg);
payload.accyg[1] = lowByte(accyg);
payload.acczg[0] = highByte(acczg);
payload.acczg[1] = lowByte(acczg);
I don’t know how you can receive the data in the right order. I used this code for receive the data, but with the delay’s between the read() functions is it not good. I hope that the right data arrived by the right function and is of course a bad idea .
The receive code:
payload.id = Serial.read();
delay(1);
payload.teller[0] = Serial.read();
delay(1);
payload.teller[1] = Serial.read();
delay(1);
payload.accxg[0] = Serial.read();
delay(1);
payload.accxg[1] = Serial.read();
delay(1);
payload.accyg[0] = Serial.read();
delay(1);
payload.accyg[1] = Serial.read();
delay(1);
payload.acczg[0] = Serial.read();
delay(1);
payload.acczg[1] = Serial.read();
delay(1);
Does anyone know how to receive it correctly?
Sorry for my english, its not so good…
Thanks for help