- Sun Mar 12, 2017 7:31 pm
#17207
Hi guys,
Im trying to get realtime data from speeduino to the serial monitor via "R" command but it returns strange values (mostly 255). Does anybody know what I am doing wrong?
Following code is programmed on an Arduino which has TX1/Rx1 connected to Speeduino's RX0/TX0.
Code:
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
int index = 0;
byte data[40];
Serial1.write("R");
if (Serial1.available())
{
while(index<39)
{
data[index] = Serial1.read();
Serial.println(data[index]);
index++;
}
Serial.println("------");
Serial.flush();
}
delay(1000);
}
Data I receive on serial monitor:
------
82
255
255
255
255
255
255
255
82
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
------
Im trying to get realtime data from speeduino to the serial monitor via "R" command but it returns strange values (mostly 255). Does anybody know what I am doing wrong?
Following code is programmed on an Arduino which has TX1/Rx1 connected to Speeduino's RX0/TX0.
Code:
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
int index = 0;
byte data[40];
Serial1.write("R");
if (Serial1.available())
{
while(index<39)
{
data[index] = Serial1.read();
Serial.println(data[index]);
index++;
}
Serial.println("------");
Serial.flush();
}
delay(1000);
}
Data I receive on serial monitor:
------
82
255
255
255
255
255
255
255
82
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
------