I have an Xbee connected via serial2 on teensy 3.1
This code works fine no problem
However when i implement this code into my project i get nothing.
I tried
and it passed however Serial2.println("text"); does not work I get nothing in the output, and I cannot read anything.
I noticed that adding serial2.begin(19200); before every print line somehow works but reading does not work.
Can anyone help with this?
This code works fine no problem
C++:
void setup() {
Serial.begin(19200);
Serial2.begin(19200);
}
void loop() {
Serial2.println("test");
delay(1000);
String message = "";
char incomingByte;
while (Serial2.available()>0){
incomingByte = Serial2.read();
message += incomingByte;
}
if (message != ""){
Serial.println(message);
}
}
However when i implement this code into my project i get nothing.
I tried
Code:
while(!Serial2);
I noticed that adding serial2.begin(19200); before every print line somehow works but reading does not work.
Can anyone help with this?