How to send/receive more than 1 integer through serial communication?


as know there lots of method send/receive integers not figure out how send multiple data?

in project i'am using 2 arduinos 1 attached accelerometer sensor and  sensor gives me 2 angle values outputs "30" , "-22". (angle values around x , y axis)

i use them inputs other arduino using serial communication.

according forum search found article useful said, need send 2 integers.

http://forum.arduino.cc/index.php/topic,99225.0.html

is possible enter sensor outputs serial window (30,-22);

output:

30
-22

could please me how can that?

thanks.

use serial.print many times need output many things need:-
code: [select]

int val1 = 30;
int val2 = -20;
serial.print("first value ");
serial.print(val1);
serial.print(" second value ");
serial.println(val2);    // print , start new line.


Arduino Forum > Using Arduino > Programming Questions > How to send/receive more than 1 integer through serial communication?


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code