ESC - Bidirectional
Breadboard for "ESC - Bidirectional"
Fritzing diagram: docs/breadboard/esc-bidirectional.fzz
Run this example from the command line with:
node eg/esc-bidirectional.js
var five = require("../");
var board = new five.Board();
board.on("ready", function() {
var start = Date.now();
var esc = new five.ESC({
device: "FORWARD_REVERSE",
neutral: 50,
pin: 11
});
var throttle = new five.Sensor("A0");
var brake = new five.Button(4);
brake.on("press", function() {
esc.brake();
});
throttle.scale(0, 100).on("change", function() {
// 2 Seconds for arming.
if (Date.now() - start < 2e3) {
return;
}
if (esc.value !== this.value) {
esc.speed(this.value);
}
});
});
License
Copyright (c) 2012, 2013, 2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2016 The Johnny-Five Contributors Licensed under the MIT license.