This week in Physical Computing we learned about serial communication.
This means that we can put whatever 2 devices talking together. In our case, the main goal is to put our microcontroler (the Arduino) and our p5.js sketch speaking the same language and sending information to each other.
In order to establish this communication there are 3 basic things we need to make sure the 2 devices agree on:
- the rate at which data is sent and read
- the voltage levels representing a 1 or a 0 bit
- the meaning of those voltage levels; is a high voltage 1 and a low voltage 0, or is the signal inverted so that a low voltage is a 1 and high voltage is 0?
Once that is set, it is time to make magic happen!
I tried doing some basic tests to using the p% sketch as an INPUT and then as an OUTPUT.
When as an input, I made controlled the movement of a graph in p5 with a potentiometer connected to my breadboard:
Then it was time to use the p5 as an OUTPUT: