Fritzing diagram: docs/breadboard/multi-bmp180-sfe.fzz
Run this example from the command line with:
node eg/altimeter-BMP180.js
var five = require("../");
var board = new five.Board();
board.on("ready", function() {
// By including a base `elevation` property, the values
// received will be absolute elevation (from sealevel)
var alt = new five.Altimeter({
controller: "BMP180",
// Change `elevation` with whatever is reported
// on http://www.whatismyelevation.com/.
// `12` is the elevation (meters) for where I live in Brooklyn
elevation: 12,
});
alt.on("change", function() {
console.log("altimeter");
console.log(" feet : ", this.feet);
console.log(" meters : ", this.meters);
console.log("--------------------------------------");
});
});
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
// By omitting the base `elevation` property, the values
// received will be relative to your present elevation
var alt = new five.Altimeter({
controller: "BMP180",
});
alt.on("change", function() {
console.log("altimeter");
console.log(" feet : ", this.feet);
console.log(" meters : ", this.meters);
console.log("--------------------------------------");
});
});
Fritzing diagram: docs/breadboard/multi-bmp180.fzz
Copyright (c) 2012, 2013, 2014 Rick Waldron [email protected] Licensed under the MIT license. Copyright (c) 2016 The Johnny-Five Contributors Licensed under the MIT license.