Description:
This lab was completed in three parts. First we made a single LED fad from min to max brightness with the "fading" example sketch. The PWM pins take a int from 0 to 255 and outputs a corresponding pwm signal. For LED brightness, therefore, fading is achieve by incrementing the pwm value up or down and delaying in between.
Then we made three LEDs cross fade with the provided "Dimming LEDs" sketch. They crossfaded through patterns using a series of nested if-else statements and incrementing a counter.
Finally, the "serial_LED" sketch allowed us to send active commands to the ariduino via serial communication. The sketch would parse the format (color)(brightness) and set the corresponding LED.
For the homework assignment, I modified the serial LED code with a function writeLED that takes the color percentage and increments it. Then I write that new percentage (scaled to 255) to the LED.
For my diffuser, I imagined a lamp that gets angry at you for stretching out its springs. For this I fed a small piece of diffusing paper into the spring and then wired a red LED into the paper. Positioning the LED inside the lamp proved difficult and in future assignments I may get the entire system functioning with more inputs and outputs.
Materials:
- Arduino UNO
- Jumpers
- Three (3) 220 Ohm resistors
- Red, Green, Blue LEDs (one each)
Code:
The homework code is attached as SerialLEDs_multiplepresses.txt
- Login to post comments