mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user