This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
|
oak:tutorials:blink [2016/03/22 13:56] jwhendy added conclusion |
oak:tutorials:blink [2016/03/22 14:02] jwhendy |
||
|---|---|---|---|
| Line 73: | Line 73: | ||
| This code tells the Oak that we will be using pin 1 as an output, and then loops over and over sending a ''HIGH'' signal to pin 1 (turns the LED on), waits 1 second, and then turns the LED off by sending a ''LOW'' signal. | This code tells the Oak that we will be using pin 1 as an output, and then loops over and over sending a ''HIGH'' signal to pin 1 (turns the LED on), waits 1 second, and then turns the LED off by sending a ''LOW'' signal. | ||
| - | You can find a template like this in the Arduino IDE under ''File -> Examples -> Oak Examples -> Start''. Otherwise, start a new sketch and copy/paste the above into your file. Make sure the port and board selections are correct and then upload the code (the button above the text window with a right arrow icon). You should see this in the message area at the bottom of the Arduino window: | + | You can find a template like this in the Arduino IDE under ''File -> Examples -> Oak Examples -> Start''. Otherwise, start a new sketch and copy/paste the above into your file. With your Oak plugged powered on, make sure the Arduino board selection is correct, and then upload the code (the button above the text window with a right arrow icon). You should see this in the message area at the bottom of the Arduino window: |
| <code> | <code> | ||
| Line 89: | Line 89: | ||
| [[http://digistump.com/wiki/_media/oak/tutorials/blink-simple.gif|{{oak:tutorials:blink-simple.gif?300}}]] | [[http://digistump.com/wiki/_media/oak/tutorials/blink-simple.gif|{{oak:tutorials:blink-simple.gif?300}}]] | ||
| - | ===== Code: changing LED behavior ===== | + | === changing LED behavior === |
| Now that you have a general idea of how to turn a light on and off, what else could you do? How might you make the blink shorter or longer? What do you think this changed code might do? (Hint: compare the delay values after each step!) | Now that you have a general idea of how to turn a light on and off, what else could you do? How might you make the blink shorter or longer? What do you think this changed code might do? (Hint: compare the delay values after each step!) | ||
| Line 116: | Line 116: | ||
| </code> | </code> | ||
| - | With this code, the light will blink for a shorter time and stay off longer. | + | With this code, the light will blink for a shorter time and stay off longer. |
| ===== Conclusion ===== | ===== Conclusion ===== | ||
| Line 126: | Line 126: | ||
| * uploading a sketch | * uploading a sketch | ||
| * setting a pin as an ''OUTPUT'' | * setting a pin as an ''OUTPUT'' | ||
| - | * gain an understanding of ''loop()'', which does something again and again | + | * understanding the ''loop()'' section, which does something again and again |
| * sending a ''HIGH'' and ''LOW'' voltage to a pin | * sending a ''HIGH'' and ''LOW'' voltage to a pin | ||
| * using ''delay()'' to affect the behavior of an LED | * using ''delay()'' to affect the behavior of an LED | ||
| Keep your momentum going and take a look at the [[http://digistump.com/wiki/oak/tutorials/leds|next tutorial]] which will get you started wiring up LED bulbs, resistors, and some more advanced coding! | Keep your momentum going and take a look at the [[http://digistump.com/wiki/oak/tutorials/leds|next tutorial]] which will get you started wiring up LED bulbs, resistors, and some more advanced coding! | ||