Node.js for Embedded Systems by Patrick Mulder

Node.js for Embedded Systems by Patrick Mulder

Author:Patrick Mulder
Language: eng
Format: epub
Publisher: O'Reilly Media
Published: 2016-10-05T16:00:00+00:00


Proximity

If you want to build a robot, one common approach for obstacle detection is an ultrasonic distance meter. Johnny-Five has a nice module to work with proximity detectors.

Look at the following code for an example based on the SRF10 sensor:

// check_proximity.js var five = require("johnny-five"); 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."); }); });



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.