
The “Call and Response” method of serial communication is the most robust way to send data (such as multiple sensors) to and from the Arduino and Processing / P5.
Note that is has one disadvantage: the Arduino waits until your receiving software (e.g. Processing) sends something back = i.e. “responds”. So it seems frozen and you can’t see data in the Serial Monitor. Once you start the Processing sketch, however, data flow begins and you can easily view it in the console.
Start with Arduino built-in example “SerialCallResponseASCII“
- open from Files / Examples / 04.Communication /
Here is my improved version of the Processing code contained in the above example, plus for VirtualColorMixing, as well as a bonus LineDrawing sketch –
https://github.com/ericjforman/SerialCommunicationASCII
The above code also contains versions for p5!
Leave a Reply