-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Altimeter
Scott González edited this page Nov 10, 2015
·
10 revisions
The Altimeter
class constructs objects that represent a single Altimeter sensor attached to the physical board.
Supported Altimeters:
This list will continue to be updated as more component support is implemented.
-
General Options
Property Type Value/Description Default Required controller string MPL3115A2. The Name of the controller to use Yes address number Address for I2C device. By Device No freq number Milliseconds. The rate in ms of data events. 25 No
Property Name | Description | Read Only |
---|---|---|
id |
A user definable id value. Defaults to a generated uid. | No |
feet |
The current altitude value in feet. | Yes |
meters |
The current altitude value in meters. | Yes |
new five.Altimeter({
controller: "MPL3115A2"
});
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
var barometer = new five.Altimeter({
controller: "MPL3115A2"
});
barometer.on("data", function() {
console.log("Altitude");
console.log(" feet : ", this.feet);
console.log(" meters : ", this.meters);
console.log("--------------------------------------");
});
});
There are no Altimeter
specific methods.
-
change The "change" event is emitted whenever the value of the altitude sensor changes.
-
data The "data" event is fired as frequently as the user defined
freq
will allow in milliseconds.