UNPKG

johnny-five-electron

Version:

Temporary fork to support Electron (to be deprecated)

43 lines (35 loc) 786 B
var five = require("../lib/johnny-five.js"); var board = new five.Board(); board.on("ready", function() { // Initialize the RGB LED var led = new five.Led.RGB({ controller: "PCA9685", isAnode: true, pins: { red: 2, green: 1, blue: 0 }, }); // RGB LED alternate constructor // This will normalize an array of pins in [r, g, b] // order to an object (like above) that's shaped like: // { // red: r, // green: g, // blue: b // } // var led = new five.Led.RGB({ // pins: [2, 1, 0], // isAnode: true, // controller: "PCA9685" // }); // Add led to REPL (optional) this.repl.inject({ led: led }); // Turn it on and set the initial color led.on(); led.color("#FF0000"); led.blink(1000); });