Skip to content

Instantly share code, notes, and snippets.

@DiegoTc
Last active October 15, 2019 04:19
Show Gist options
  • Save DiegoTc/10611021 to your computer and use it in GitHub Desktop.
Save DiegoTc/10611021 to your computer and use it in GitHub Desktop.
Blinking a LED with BeagleBone Black
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);
<img src="http://s18.postimg.org/rtrc7t1zd/blinking_led_bb.png" alt="some_text">
<p>
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.</p>
<p>
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.</p>

alt tag

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.

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.

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.

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.

Materials

  1. BeagleBone Black
  2. LED your choice of color and size. I used 10mm Red
  3. 470Ω Resistor
  4. Half-size solderless breadboard
  5. Male to Male jumper wires
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);
@darkworks
Copy link

not working on my beaglebone black wireless ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment