UNPKG

johnny-five-electron

Version:

Temporary fork to support Electron (to be deprecated)

31 lines (23 loc) 630 B
var five = require("../lib/johnny-five.js"), board, potentiometer; board = new five.Board(); board.on("ready", function() { // Create a new `potentiometer` hardware instance. potentiometer = new five.Sensor({ pin: "A2", freq: 250 }); // Inject the `sensor` hardware into // the Repl instance's context; // allows direct command line access board.repl.inject({ pot: potentiometer }); // "data" get the current reading from the potentiometer potentiometer.on("data", function() { console.log(this.value, this.raw); }); }); // References // // http://arduino.cc/en/Tutorial/AnalogInput