Serial.available misbehaving on Leonardo


i'm using arduino pro micro, based on leonardo, serial communication.

i'm finding serial.available command misbehaving, can seen in following example, lets buffer fill incoming characters, , reports how many there every second:

code: [select]
void setup()
{
  serial.begin(9600);
}

void loop()
{
  serial.println(serial.available());
  delay(1000);
}


if open serial terminal, program steadily prints 0s, expect.

send character arduino, , returns 1s. far good.

send character , continues sending 1s. strange, should sending 2s now.

send third character , serial terminal crashes, along entire arduino environment, until unplug usb connection arduino.

this baffling, since i'm sure have used serial buffer on leonardo before. upgrade windows 10? i'd appreciate anyone's help. thanks.

strangely problem above seems have fixed itself. buffer fills 63 bytes, expected. restarting arduino environment may have fixed it. didn't restart pc.

the ardunio terminal program still crashes in same way when overfill buffer beyond 63 bytes, original problem seems have been arduino behaving though buffer length 1.

any tips still appreciated.


Arduino Forum > Using Arduino > Programming Questions > Serial.available misbehaving on Leonardo


arduino

Comments