Arduino Developer Notes

Serial

SerialEvent

The SerialEvent is not really usable because of its very slow reaction. It seems only be called if the UART buffer is full.
Better is to use a function which is periodically called from the main loop which check if bytes are available.

void loop() {
  delay(10);
  doSerial();
}
 
 
void doSerial() {
  while (Serial.available()) {
    // get the new byte:
    char c = (char)Serial.read();
  }
}


PC Connection

After opening the serial port with a host program a wait of 2..3 seconds is needed before the UNO is ready to receive data.


Personal Tools