Skip to content

Commit 531dbc2

Browse files
committed
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.
1 parent d1bd145 commit 531dbc2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

java/libraries/serial/examples/SimpleWrite/SimpleWrite.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ boolean mouseOverRect() { // Test if mouse is over square
5353
}
5454
5555
void loop() {
56-
if (Serial.available()) { // If data is available to read,
56+
while (Serial.available()) { // If data is available to read,
5757
val = Serial.read(); // read it and store it in val
5858
}
5959
if (val == 'H') { // If H was received

0 commit comments

Comments
 (0)