UNPKG

johnny-five

Version:

The JavaScript Robotics and Hardware Programming Framework. Use with: Arduino (all models), Electric Imp, Beagle Bone, Intel Galileo & Edison, Linino One, Pinoccio, pcDuino3, Raspberry Pi, Particle/Spark Core & Photon, Tessel 2, TI Launchpad and more!

15 lines (10 loc) 336 B
var five = require("../lib/johnny-five.js"); var board = new five.Board(); board.on("ready", function() { var slider = new five.Sensor("A0"); var tilt = new five.Servo(9); slider.scale([0, 180]).on("slide", function() { // The slider's value will be scaled to match the tilt servo range tilt.to(this.value); }); });