Fix Serial SimpleWrite example

The Arduino code would read one byte from the buffer an then sleep for 1/10th of a second, while Processing would send a byte every frame. Instead, read in all the bytes in the input buffer and act on the most recent one.
This commit is contained in:
gohai
2015-10-18 12:29:14 +02:00
parent b51dedcab0
commit 61fe120f7c
@@ -53,7 +53,7 @@ boolean mouseOverRect() { // Test if mouse is over square
}
void loop() {
if (Serial.available()) { // If data is available to read,
while (Serial.available()) { // If data is available to read,
val = Serial.read(); // read it and store it in val
}
if (val == 'H') { // If H was received