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, Raspberry Pi, Spark Core, TI Launchpad and more!
17 lines (13 loc) • 364 B
JavaScript
var five = require("../lib/johnny-five.js");
var board = new five.Board();
board.on("ready", function() {
var proximity = new five.Proximity({
controller: "SRF10"
});
proximity.on("data", function() {
console.log(this.cm + "cm", this.in + "in");
});
proximity.on("change", function() {
console.log("The obstruction has moved.");
});
});