PC to Arduino: Hello, are you still there?

I wrote these two sketches to confirm that yes, serial port communication still works between Processing and the Arduino under the new Arduino IDE.

The sketch on the left is written in Processing and writes to the serial port. The sketch on the right is written in Wiring (that is, Arduino-ese) and reads from the serial port.

The Arduino pin 13 LED flashes once when the ‘1’ key is pressed, twice when the ‘2’ key is pressed. So yes, the Arduino is still reading serial from Processing.

(So whatever problem I was having the other day with GIRC, it’s not because of the new IDE. )

The Processing sketch could stand some improvement because when you press a key, it sends multiple bytes to the Arduino because human fingers are slow compared to computer keyboard reading speeds. The Processing sketch should just send one byte and wait for the key to be released. The fix should be easy, but these sketches have served their purpose and it’s time to get back to GIRC.

About engineerzero

Once and future engineer.
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a comment