Fritzing diagram: docs/breadboard/esc-bidirectional.fzz
Run this example from the command line with:
node eg/esc-bidirectional.js
const { Board, Button, ESC, Sensor } = require("johnny-five");
const board = new Board();
board.on("ready", () => {
const esc = new ESC({
device: "FORWARD_REVERSE",
pin: 11
});
const throttle = new Sensor("A0");
const brake = new Button(4);
brake.on("press", () => esc.brake());
throttle.on("change", () => {
esc.throttle(throttle.scaleTo(esc.pwmRange));
});
});
Copyright (c) 2012-2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2015-2023 The Johnny-Five Contributors Licensed under the MIT license.