hey !
my serial.read() equal -1. problem ?
this code:
code: [select]
void setup()
{
serial.begin(9600);
}
void loop() {
serial.println(serial.read());
}
when start program , open "monitor serial"
serial.println(serial.read()) return -1 !
why ? can explain error pls ?
thanks !
-1 read returns when there's nothing there read. use serial.available check if has been received before trying read serial line , read when there.
Arduino Forum > Using Arduino > Programming Questions > Serial.read() always = -1 !
arduino
Comments
Post a Comment