Last active
August 29, 2015 14:02
-
-
Save DiegoTc/afb483bbf1c1789be837 to your computer and use it in GitHub Desktop.
Bone101 Tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p><span style="font-family: 'Gotham SSm A', 'Gotham SSm B'; font-size: 30px; line-height: 30px;">Overview</span><span style="font-family: 'Gotham SSm A', 'Gotham SSm B';"><br></span></p><p><span style="font-family: 'Gotham SSm A', 'Gotham SSm B';">In this tutorial, you will learn how to control an external LED using a BeagleBone Black (BBB) using Bonescript.</span><br></p><p><span style="font-family: 'Gotham SSm A', 'Gotham SSm B';"><img src="https://learn.adafruit.com/system/assets/assets/000/009/102/medium800/beaglebone_overview.jpg?1396883186" style="width: 204px;"><br></span></p><p><span style="font-family: 'Gotham SSm A', 'Gotham SSm B';"><br></span></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> | |
</p> | |
<table class="table table-bordered"> | |
<tbody> | |
<tr> | |
<td><span style="font-family: Arial;"> | |
Beagle Bone Black | |
</span></td> | |
<td> | |
<img src="https://learn.adafruit.com/system/assets/assets/000/009/103/medium800/beaglebone_BBB.jpg?1396883195" style="width: 131.5px;"> | |
<br> | |
</td> | |
</tr> | |
<tr> | |
<td><span style="font-family: Arial;"> | |
Leds | |
</span></td> | |
<td> | |
<img src="https://learn.adafruit.com/system/assets/assets/000/009/104/medium800/beaglebone_LEDs_5mm_assorted_colors.jpg?1396883218" style="width: 131.5px;"> | |
<br> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<span style="font-family: Arial;"> | |
470Ω Resistor | |
</span> | |
<br> | |
</td> | |
<td> | |
<img src="https://learn.adafruit.com/system/assets/assets/000/009/105/medium800/beaglebone_R-470-level.jpg?1396883232" style="width: 131.5px;"> | |
<br> | |
</td> | |
</tr> | |
<tr> | |
<td><span style="font-family: Arial;"> | |
Half-size solderless breadboard</span><br> | |
</td> | |
<td> | |
<img src="https://learn.adafruit.com/system/assets/assets/000/009/106/medium800/beaglebone_breadboard_half_web.jpg?1396883242" style="width: 131.5px;"><br> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<span style="font-family: Arial;">Wires</span> | |
</td> | |
<td> | |
<img src="https://learn.adafruit.com/system/assets/assets/000/009/107/medium800/beaglebone_jumpers_web.jpg?1396883256" style="width: 131.5px;"><br> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
<br> | |
<p> | |
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p><span style="font-family: 'Gotham SSm A', 'Gotham SSm B'; font-size: 30px; line-height: 30px;">Wiring</span><br></p><p><span style="font-family: 'Gotham SSm A', 'Gotham SSm B';">Wire up the solderless breadboard using the header leads as shown below.</span><span style="font-family: 'Gotham SSm A', 'Gotham SSm B'; font-size: 30px; line-height: 30px;"><br></span></p><p><span style="font-family: 'Gotham SSm A', 'Gotham SSm B';"><img src="https://learn.adafruit.com/system/assets/assets/000/009/108/medium800/beaglebone_fritzing.png?1396883299" style="width: 263px;"><br></span></p><p><span style="font-family: 'Gotham SSm A', 'Gotham SSm B';">Push the LED leads into the breadboard, with the longer (positive) lead towards the top of the breadboard. It does not matter which way around the resistor goes.</span><span style="font-family: 'Gotham SSm A', 'Gotham SSm B';"><br></span></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span style="font-family: 'Gotham SSm A', 'Gotham SSm B';">The top two connections on the BBB expansion header we are using (P8) are both GND. The other lead is connected to pin 10, which is the right-hand connector on the fifth row down. The pins are numbered left to right, 1, 2 then on the next row down 3,4 etc.</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre> | |
var b = require('bonescript'); | |
var led = "P8_10"; | |
var state = 0; | |
b.pinMode(led, 'out'); | |
toggleLED = function() { | |
state = state ? 0 : 1; | |
b.digitalWrite(led, state); | |
}; | |
timer = setInterval(toggleLED, 100); | |
stopTimer = function() { | |
clearInterval(timer); | |
}; | |
setTimeout(stopTimer, 3000); | |
</pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1><span style="font-family: 'Gotham SSm A', 'Gotham SSm B'; font-weight: bold;">Next Steps</span></h1><p><span style="font-family: 'Gotham SSm A', 'Gotham SSm B';">Try editing your program and changing the sleep period from half a second to 2 seconds and run the program again.</span><br style="font-family: 'Gotham SSm A', 'Gotham SSm B';"><span style="font-family: 'Gotham SSm A', 'Gotham SSm B';">For extra credit, try controlling another LED on a different pin!</span><br></p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment