CSCI 345: Lab 6

Analog Inputs and Outputs
Due: 10PM on Monday, April 6th

In this lab, you should learn:

  • How to use analog read and write.

To complete this lab, you will need:

  • A computer.
  • An arduino.
  • A USB cable to connect your arduino to your computer.
  • A photoresister.
  • An RGB LED (this is the LED with 4 legs).
  • A regular LED.
  • Three 270Ω resistors, a 330Ω resistor, and a 10 kΩ resistor (You could also just use 4 330s or 4 270s).
  • A breadboard.
  • Wires.

Part 0 - Github

Click here to check out your github repo.

Part 1 - Using analog write.

Previous to this we have only been using digital signals for our inputs and outputs. This means things have either been on/high/1 or off/low/0. However, electricity can have lots of different voltages, and we can use that voltage in semantically meaningful ways. First, follow this guide to use analog output to change the color of an RGB LED.

Part 2 - Using analog read.

Follow this guide to use analog read to get data from a photoresistor.

Part 3 - Adding sound

Follow this tutorial to make a musical instrument that takes input from the photoresistor, and uses it to make sounds.

Part 4 - Get Creative

Take what you learned in the previous sections and use it to make a program that takes in input from the photoresistor, and outputs it as both light and sound. Your program must use at least the piezo buzzer and multiple LEDs, including at least one RGB LED.

Handin

You will submit your assignment by posting a comment on the piazza thread for lab 6. Your post should include a link to the a video of you demoing your program, and a link to a github repository that contains your arduino code.


C. Taylor