Introduction: How to Make LED Fader Using Digispark
ARDUINO BOARD IDE 1.0.3 CODE
//Declare all variables
//convert into a float to calculate r,g,b ( increase amplitute by multiplying by 127 and make positive by adding 1)
//convert flaot r,g,b to integer and assisting values to LED
//write LED levels to p0, p1, p4 (ASSIGN PWM values to LEDs)
//wait for 1/100 of a second
In this project a number from 0-255 is used to represent 0%-100% duty cycle (brightness), sine function is used to generate it. Digispark uses sine function to generate the PWM (pulse width modulation). We convert the radians to degree's for the red, green, blue cycles. This is used to change the language for the computer to understand.
How to build
-Cut out an 8x9 hole square hole from the perf board
-Solder female header pins to DigiSpark
-Solder the bits ( male header pins, resistors, RGB LED(longest leg is your ground)
- The resistors are soldered to the perf board in the PWM pins 1 and 4
-Then solder the resistors to the LED legs
-Solder the longest leg of the LED (ground) to the ground pin, cover the wire with insulation to avoid shorting out.
-Then use the Arduino 1.0.3 program to write your code (provided above) to program your PWM to your chip
-Plug in and play and your ready to go with your LED fader
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Participated in the