Working with serial

This week we started working with the Arduino and serial.

Here I have two potentiometers and a push button:

FullSizeRender 3

Using one sensor, I uploaded the example code to display the sensor value in different ways:

 

Screen Shot 2015-10-13 at 2.49.27 PM

We learned how to write to three sensors and view the data in the serial monitor:

Screen Shot 2015-10-13 at 2.53.15 PM

Next we learned how to use the arduino to send values from an analog sensor via serial to the p5 IDE.

My favorite friend the sliding 10K pot:

FullSizeRender

The arduino code to write the single sensor value in binary to serial is pretty simple:

Screen Shot 2015-10-13 at 2.14.18 PM

Here is the p5 sketch working with it. It is printing the serial value as text:

Screen Shot 2015-10-13 at 2.01.50 PM

Next I mapped this data into a graph:

Screen Shot 2015-10-13 at 2.06.08 PM

 

It was really exciting to get the two potentiometers and the push button to talk to p5 at the same time via serial:

Screen Shot 2015-10-13 at 4.57.55 PM

Leave a Reply

Your email address will not be published. Required fields are marked *