User Tools

Site Tools


oak:tutorials:leds

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
oak:tutorials:leds [2016/03/22 20:38]
jwhendy accidentally wrote a tutorial over a different page! copying it here to the correct location
oak:tutorials:leds [2016/03/22 20:50]
jwhendy
Line 12: Line 12:
 |5mm LED bulb, any color|2| | |5mm LED bulb, any color|2| |
 |Jumper wires|2| | |Jumper wires|2| |
-|Resistor, 220 ohm|1|Red-Red-Brown|+|Resistor, 220 ohm*|1|Red-Red-Brown| 
 + 
 +**Note:** 220 ohm is one possible option. You can use any resistor between 100-1,000 ohms if you'd like. 100 ohms will produce the brightest light and 1,000 will be a bit dimmer. Any in this range are safe.
  
 ===== Concepts ===== ===== Concepts =====
Line 38: Line 40:
   * Start by inserting the 220 ohm resistor into two different rows on the breadboard   * Start by inserting the 220 ohm resistor into two different rows on the breadboard
   * Insert the LED into the breadboard so that it's //long// leg is in the same row as the resistor, and the other leg in a different row   * Insert the LED into the breadboard so that it's //long// leg is in the same row as the resistor, and the other leg in a different row
-  * Connect ​pin 9 of the Oak to the free end of the resistor ​with a jumper wire +  * Use a jumper wire to connect ​pin 9 of the Oak to the unconnected side of the resistor 
-  * Connect ​a ground pin of the Oak to the row containing the short leg of the LED+  * Use another jumper wire to connect ​a ground pin on the Oak to the row containing the short leg of the LED
  
-If real world pictures help, you can double check your circuit against this one:+You can double check your circuit against this real world example:
  
 [[http://​digistump.com/​wiki/​_media/​oak/​tutorials/​oak-1-led.jpg|{{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​oak-1-led.jpg?​500}}]] [[http://​digistump.com/​wiki/​_media/​oak/​tutorials/​oak-1-led.jpg|{{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​oak-1-led.jpg?​500}}]]
Line 126: Line 128:
 This code may look a lot longer and possibly intimidating,​ but we've simply used the same basic structure from above (do something, then wait) over and over. The analog functions and their corresponding delays have been grouped tighter to show that these are pairs of commands. This code may look a lot longer and possibly intimidating,​ but we've simply used the same basic structure from above (do something, then wait) over and over. The analog functions and their corresponding delays have been grouped tighter to show that these are pairs of commands.
  
-Since the Oak can send values from 0-1023, this sketch cycles through some various PWM values to show you the effect. Sending ''​100''​ means that the ''​analogWrite''​ signal is high 100/1023 or about 9.8% of the time. When you upload this sketch, you'll see a demonstration of your LED going from off to full brightness in steps:+Since the Oak can send values from 0-1023, this sketch cycles through some various PWM values to show you the effect. Sending ''​100''​ means that the ''​analogWrite''​ signal is high 100/1023 or about 9.8% of the time, and sending a low signal the rest of the time. Sending ''​1023''​ means the pin is on for 100% of the time (full brightness). When you upload this sketch, you'll see a demonstration of your LED going from off to full brightness in steps: 
 + 
 +[[http://​digistump.com/​wiki/​_media/​oak/​tutorials/​oak-led-pwm-increase.gif|{{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​oak-led-pwm-increase.gif?​500}}]]
  
-[gif of progression] 
  
 Play around with the code above. Perhaps change the order (high to low), the timing between each step (altering the ''​delay()''​ value used), or the number of steps (what about a more gradual transition?​). Play around with the code above. Perhaps change the order (high to low), the timing between each step (altering the ''​delay()''​ value used), or the number of steps (what about a more gradual transition?​).
oak/tutorials/leds.txt · Last modified: 2016/03/22 20:50 by jwhendy