Deliverables and Homework: Homework 3
Learn to use an analog input to control 8 LEDs (2% of the grade):
Goal: Use the potentiometer as a haptic user interface to control eight LEDs. When the user turns the potentiometer knob one illuminated LED should "move" from one end of the LED string to the other and vice versa, depending on the potentiometer position.
Set-up: Use one of the analog inputs of the Arduino (labeled A0-5) to read out the position of the potentiometer swiper. This is done by connecting the potentiometer's left and right pins to 0V and 5V. The center pin, which connects to the swiper of the potentiometer, is connected to one of the analog input pins. This generates a swiper voltage between 0 and 5V depending on the swiper position. Essentially the potentiometer is a variable voltage divider, similar to what you measured in Deliverable 0 between the LED and the resistor. This voltage is converted by the analog input pin into a 0-1024 number that can be used to determine the LED that is supposed to light up. LED hookup: Use eight digital Arduino pins as outputs to drive the LEDs. Each LED needs to be hooked up to one of the pins with a current limiting 220 Ohm resistor.
Programming: Read out the analog pin in the loop and use conditional statements and Boolean operators to evaluate the situation and control the LEDs.
Helpful info: Intro to Programming videos about boolean operators and control structures, EEawesome videos about buttons and LEDs. The potentiometer is explained in our Servo Motor video.
To get credit: The working set-up must be demonstrated to the instructors/TAs by end of the class on the due date.
Goal: Use the potentiometer as a haptic user interface to control eight LEDs. When the user turns the potentiometer knob one illuminated LED should "move" from one end of the LED string to the other and vice versa, depending on the potentiometer position.
Set-up: Use one of the analog inputs of the Arduino (labeled A0-5) to read out the position of the potentiometer swiper. This is done by connecting the potentiometer's left and right pins to 0V and 5V. The center pin, which connects to the swiper of the potentiometer, is connected to one of the analog input pins. This generates a swiper voltage between 0 and 5V depending on the swiper position. Essentially the potentiometer is a variable voltage divider, similar to what you measured in Deliverable 0 between the LED and the resistor. This voltage is converted by the analog input pin into a 0-1024 number that can be used to determine the LED that is supposed to light up. LED hookup: Use eight digital Arduino pins as outputs to drive the LEDs. Each LED needs to be hooked up to one of the pins with a current limiting 220 Ohm resistor.
Programming: Read out the analog pin in the loop and use conditional statements and Boolean operators to evaluate the situation and control the LEDs.
Helpful info: Intro to Programming videos about boolean operators and control structures, EEawesome videos about buttons and LEDs. The potentiometer is explained in our Servo Motor video.
To get credit: The working set-up must be demonstrated to the instructors/TAs by end of the class on the due date.