Created
March 13, 2016 22:56
-
-
Save makenai/1047a42855cde861532d to your computer and use it in GitHub Desktop.
Temporal queue plus servo timings.
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
var five = require("johnny-five"); | |
var temporal = require('temporal'); | |
var board = new five.Board({ | |
debug: false | |
}); | |
// Outputs: | |
// --- | |
// node testCase.js | |
// >> One | |
// --- | |
// (Then nothing) | |
// If you remove the timings from the servo.to() calls, it works fine. | |
board.on("ready", function() { | |
var servo = new five.Servo({ | |
pin: 9, | |
startAt: 5 | |
}); | |
temporal.queue([ | |
{ | |
delay: 500, | |
task: function() { | |
console.log('One'); | |
servo.to(20, 200); | |
} | |
}, | |
{ | |
delay: 500, | |
task: function() { | |
console.log('Two'); | |
servo.to(5, 200); | |
} | |
}, | |
{ | |
delay: 500, | |
task: function() { | |
console.log('Three'); | |
servo.to(20, 200); | |
} | |
}, | |
{ | |
delay: 500, | |
task: function() { | |
console.log('Four'); | |
servo.to(5, 200); | |
} | |
} | |
]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment