Assignment #4 – Analog outputs with the arduino

This weeks lab covered interfacing the Arduino with servo motors and speakers. The servo lab basically involves mapping the range of an analog input (variable resistor) to the servo motors full rotation.

FullSizeRender 5

The tone lab uses the tone library in Arduino to map an analog input to a frequency range on the speaker.

FullSizeRender 4

I decided now would be a great time for me to use this nintendo DS touchscreen that I had lying around. Sparkfun has some great information on how to use this screen. Basically it is two variable resistor arrays. One for X values and one for Y values.

bussbarslarge

I found some code by John Boxall very helpful. (http://tronixstuff.com/2010/12/29/tutorial-arduino-and-the-ds-touch-screen)  He explains how to alternate pins between analogWrite and analogRead in order to get the touch screen to work on its four connections.

I decided to map the touch screen to four sections, similar to what we learned in ICM early on with p5.js.

I used these four sections to toggle between four colors. Here is the final product:

 

Leave a Reply

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