Skip to content

Instantly share code, notes, and snippets.

@DiegoTc
Created June 30, 2015 13:27
Show Gist options
  • Select an option

  • Save DiegoTc/5cffc9f94f8a61daffad to your computer and use it in GitHub Desktop.

Select an option

Save DiegoTc/5cffc9f94f8a61daffad to your computer and use it in GitHub Desktop.
title: Led on!, description: Let's Turn on led number one!
var b = require('bonescript');
var led = "USR3";
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);
<h2>Build and execute instructions</h2>
<p>&nbsp;</p>
<ul>
<li>Run the example code and observe USR3 blinking.</li>
<li>Alter the frequency and re-run the example.</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment