-
Notifications
You must be signed in to change notification settings - Fork 6
BME280 Barometric Pressure, Temperature, Humidity sensor
Jake Hartnell edited this page Jul 18, 2016
·
4 revisions
// Require the Grow.js build and johnny-five library.
var GrowInstance = require('Grow.js');
var five = require('johnny-five');
var ascii = require('ascii-codes');
// Create a new board object
var board = new five.Board();
// When board emits a 'ready' event run this start function.
board.on('ready', function start() {
var multi = new five.Multi({
controller: "BME280"
});
// Create a new grow instance.
var grow = new GrowInstance({
host: 'IP_ADDRESS_OF_GROW-IOT_SERVER',
port: 3000,
name: 'BMP280', // The display name for the thing.
desription: 'BMP280',
username: 'YOURUSERNAMEHERE', // The username of the account you want this device to be added to.
actions: {
temp_data: {
name: 'Temperature sensor',
template: 'sensor',
type: 'temperature',
schedule: 'every 2 seconds',
function: function () {
// // Send value to Grow-IoT
grow.log({
type: 'temperature',
value: multi.temperature.celsius
});
}
},
barometric: {
name: 'Barometric pressure sensor',
template: 'sensor',
type: 'barometric',
schedule: 'every 2 seconds',
function: function () {
// // Send value to Grow-IoT
grow.log({
type: 'barometric',
value: multi.barometer.pressure
});
}
},
humidity: {
name: 'Barometric pressure sensor',
template: 'sensor',
type: 'humidity',
schedule: 'every 2 seconds',
function: function () {
// // Send value to Grow-IoT
grow.log({
type: 'humidity',
value: multi.hygrometer.relativeHumidity
});
}
}
}
});
});