Skip to content

Instantly share code, notes, and snippets.

@robshep
Created July 25, 2015 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robshep/c2c3794596fa8e4f324b to your computer and use it in GitHub Desktop.
Save robshep/c2c3794596fa8e4f324b to your computer and use it in GitHub Desktop.
code.js
var width = 0.7; // to 2.3
var freq = 20; // to 100;
var i = null;
var go = function(){
i = setInterval(function() {
digitalPulse(B10, 1, width);
}, freq);
};
var stop = function(){
clearInterval(i);
};
var setFreq = function(fIn){
freq = fIn;
stop();
go();
};
var setWidth = function(wIn){
width = wIn;
stop();
go();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment