User Tools

Site Tools


oak:tutorials:rgb-led

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
oak:tutorials:rgb-led [2016/03/23 22:19]
jwhendy [Circuit] added picture
oak:tutorials:rgb-led [2016/04/19 17:44] (current)
jwhendy fixed wrong pin number
Line 12: Line 12:
 |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 54: Line 57:
   pinMode(6, OUTPUT);   pinMode(6, OUTPUT);
   pinMode(7, OUTPUT);   pinMode(7, OUTPUT);
-  pinMode(7, OUTPUT);+  pinMode(8, OUTPUT);
  
 } }
Line 84: 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 157: 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 =====
oak/tutorials/rgb-led.1458796751.txt.gz · Last modified: 2016/03/23 22:19 by jwhendy