Sending integer values through serial
hi guys,
i trying figure out best way send integer value 1 due board via serial (tx/rx). receive value sensor (compass) integer , want send straight board no 2.
but not getting same value board 1 board no2. have searched online , have come across/tried soooo many different approach confusing hell out of me.
all need is, if send 45 should receive 45.
bit lost, or i'm missing something
please help!!
board 1 sender:
board 2 receiver:
i trying figure out best way send integer value 1 due board via serial (tx/rx). receive value sensor (compass) integer , want send straight board no 2.
but not getting same value board 1 board no2. have searched online , have come across/tried soooo many different approach confusing hell out of me.
all need is, if send 45 should receive 45.
bit lost, or i'm missing something
please help!!
board 1 sender:
code: [select]
int compassvalue;
void setup() {
serial1.begin(115200);
compassvale = 359;
}
void loop() {
serial1.write(compassvalue); // sent binary???
delay(200);
}
board 2 receiver:
code: [select]
void setup() {
serial1.begin(115200);
}
void loop() {
if (serial1.available())
{
serial.print(serial1.read()); // (debug) want send data serial read integer sd card/
delay(200);
}
have @ examples in serial input basics - simple reliable ways receive data. system in 3rd example reliable.
it easier make sending code match receiving code rather vice versa.
it easier debug programs if data sent human readable characters rather binary data. suggest use binary data if required throughput can't achieved other way.
...r
it easier make sending code match receiving code rather vice versa.
it easier debug programs if data sent human readable characters rather binary data. suggest use binary data if required throughput can't achieved other way.
...r
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Sending integer values through serial
arduino
Comments
Post a Comment