Skip to content

Instantly share code, notes, and snippets.

@bjpirt
Created February 21, 2017 16:39
Show Gist options
  • Save bjpirt/d683f7f9c758ef06f4f45d11442207bc to your computer and use it in GitHub Desktop.
Save bjpirt/d683f7f9c758ef06f4f45d11442207bc to your computer and use it in GitHub Desktop.
var KS = require('./kickstarter-data/');
var MeArmPi = require('../mearm-js/lib/MeArmPi.js').MeArmPi,
arm = new MeArmPi();
var backers = 0;
arm.moveBaseTo(20);
function drawBack(current, dest, cb){
if(current < dest){
current++;
arm.moveBaseTo(current);
setTimeout(function(){ drawBack(current, dest, cb)}, 50);
}else{
cb();
}
}
function gong(cb){
console.log("GONG!");
drawBack(20, 90, function(){
arm.moveBaseTo(0, function(res){
if(res === 'complete') drawBack(0, 20, function(){});
});
})
}
var options = { url: "https://www.kickstarter.com/projects/mime/mearm-pi-build-your-own-raspberry-pi-powered-robot" }
var project = new KS.project(options);
function check(){
project.backers(function(err, data){
if(backers !== data.backers){
backers = data.backers;
console.log(backers);
gong();
}
})
}
setInterval(check, 10000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment