This shows you the differences between two versions of the page.
| Next revision | Previous revision Last revision Both sides next revision | ||
|
oak:tutorials:rgb-led [2016/03/23 21:41] jwhendy created |
oak:tutorials:rgb-led [2016/03/23 23:17] jwhendy [Components used] |
||
|---|---|---|---|
| Line 8: | Line 8: | ||
| ^Part ^Quantity ^Identification^ | ^Part ^Quantity ^Identification^ | ||
| - | |Oak with soldered headers|1|| | + | |Oak with soldered headers| 1 | | |
| - | |Breadboard|1| | | + | |Breadboard| 1 | | |
| |Jumper wires | 4 | | | |Jumper wires | 4 | | | ||
| - | |RGB LED|1|whitish LED with 4 leads, one longer than the others| | + | |RGB LED| 1 | whitish LED with 4 leads, one longer than the others | |
| + | |Resistor, 220 ohm| 3 | Red-Red-Brown| | ||
| + | |||
| + | **Note:** 220 ohms is a ballpark recommendation; acceptable values are between 100 - 1k ohms. | ||
| ===== Concepts ===== | ===== Concepts ===== | ||
| Line 38: | Line 41: | ||
| * Connect one jumper wire from pins 6, 7, and 8 to each of the free ends of the resistor | * Connect one jumper wire from pins 6, 7, and 8 to each of the free ends of the resistor | ||
| + | Here is an example of a real world setup: | ||
| + | |||
| + | [[http://digistump.com/wiki/_media/oak-wiring-rgb-led.jpg|{{http://digistump.com/wiki/_media/oak-wiring-rgb-led.jpg?400}}]] | ||
| ===== Code ===== | ===== Code ===== | ||
| Line 81: | Line 87: | ||
| You should see each color pulse, one at a time, each over the course of ~2 seconds. | You should see each color pulse, one at a time, each over the course of ~2 seconds. | ||
| + | |||
| + | [[http://digistump.com/wiki/_media/oak-rgb-led-cycle.gif|{{http://digistump.com/wiki/_media/oak-rgb-led-cycle.gif?400}}]] | ||
| === Code: fading through the rainbow === | === Code: fading through the rainbow === | ||
| Line 154: | Line 162: | ||
| We ramp up the red channel of the LED, and when it's halfway through (when ''i = 500''), the green channel begins ramping up. At ''i = 1000'', the red channel is fully on, green is halfway to full on, and blue is just starting. They start and stop the process approximately half a second offset from each other, and once they're all at full brightness, the process reverses to bring them back down to off. | We ramp up the red channel of the LED, and when it's halfway through (when ''i = 500''), the green channel begins ramping up. At ''i = 1000'', the red channel is fully on, green is halfway to full on, and blue is just starting. They start and stop the process approximately half a second offset from each other, and once they're all at full brightness, the process reverses to bring them back down to off. | ||
| - | Here's what you will see with the code above! | + | Here's what you will see with the code above! It's a bit hard to make out, but the progression is red, yellow, white, cyan, blue. |
| + | |||
| + | [[http://digistump.com/wiki/_media/oak/tutorials/oak-rgb-led-rainbow.gif|{{http://digistump.com/wiki/_media/oak/tutorials/oak-rgb-led-rainbow.gif?400}}]] | ||
| ===== Conclusion ===== | ===== Conclusion ===== | ||