Different uart for XBEE

This commit is contained in:
giuliof 2018-12-18 20:26:10 +01:00
parent baef89a9c4
commit 0d535aad56
1 changed files with 6 additions and 2 deletions

View File

@ -129,21 +129,25 @@ void setup()
leftcountvalue = 0xAAA0;
serialvalue = 0x0000;
// Communication w/PC for debug or other puroposes
Serial.begin(9600);
Serial.println("Arduino Serial Link");
Serial.println("connected!");
// Communication w/XBEE
Serial1.begin(9600);
}
void loop()
{
if (Serial.available())
if (Serial1.available())
{
/* ** Buffer to store received char **
* Data is an integer string terminated with newline '\n'
* */
static String inputString = "";
char digit = Serial.read(); // Read serial buffer
char digit = Serial1.read(); // Read serial buffer
// Check if string terminator
if (digit == '\n')
{