Hi all,
I am programming on a Leonardo using Arduino 1.0.4 and I cant understand why the following code is printing "Got data on Serial1"
There is nothing connected to TX1 and RX1 so why is it telling my data is available in the buffer! Am I missing something extremely obvious here??
Thanks,
Serge
void setup() {
Serial.begin(57600);
while (!Serial);
Serial1.begin(9600);
}
void loop() {
while(Serial1.available() <= 0) {
delay(50);
}
Serial.println("Got data on Serial1");
delay(500);
}
There is nothing connected to TX1 and RX1 so why is it telling my data is available in the buffer!
If there is nothing connected to TX1 and RX1, why are you reading them?
Hi,
I had something connected (another Leonardo) but to prove to myself that there was no incoming data I disconnected the pins. The same test based on Serial seems to work fine so at this stage I can only assume its some sort of hardware/software bug.
Serge
I can only assume its some sort of hardware/software bug.
Or noise, on unconnected pins.
ssozonoff:
void setup() {
Serial.begin(57600);
while (!Serial);
Serial1.begin(9600);
}
void loop() {
while(Serial1.available() <= 0) {
delay(50);
}
Serial.println("Got data on Serial1");
delay(500);
}
From what I'm seeing, you're just printing "Got data on Serial1" to the serial monitor without checking anything...?
OK, so I was being stupid ....
-
For the Leonardo <-> Leonardo I forgot to wire a common GND.
-
I assume as has been pointed out that the pins float if they are left un-connected.
Sorry about this guys.
Serge