Description
This lab was to program a fading of LEDs covered by a diffuser to observe how the light from LEDs spread over the diffuser material. I chose a kitchen tissue rolled up into a cone as the diffuser. I also modified the code to reduce the time interval between consequent delays to observe the color changes quickly. Code attached in DigitalIOQuestion1.txt
The second question required using keyboard input (rrrrr to set r to 50%) to set color intensity for the LEDs. I captured user input and used the length to correspond to a intensity value. Since 50% was equivalent to 127, each character would correspond to 10% or 25.4 intensity value. E.g. if 'rrrrr' was entered it would set the red LED to 50% value or 127. Code attached in DigitalIOQuestion2.txt
The third part was to use some other means to alter the color intensity using the keyboard. I chose to use the normal conventions of + and - to increase or decrease the intensity. I altered code to accept input of the form -color character with a +/- (e.g. r+,r-,g+,g-,b+,b-). I kept track of the current intensity values of the LEDs. So once the input was keyed in, it would increase or decrease the LED intensity by 10%. E.g. if r+ was entered it would increment the current intensity of red LED by 25.4. Code attached in DigitalIOQuestion3.txt
Materials Used:
1- Breadboard
1- Arduino Uno
3- LED
3 - 220 ohm resistors
1- Kitchen tissue as diffuser
- Login to post comments