Last active
December 20, 2015 05:09
-
-
Save sandeepmistry/6075857 to your computer and use it in GitHub Desktop.
node.js TI SensorTag humidity sensor example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SensorTag = require('sensortag'); | |
SensorTag.discover(function(sensorTag) { | |
console.log('discover'); | |
sensorTag.connect(function() { | |
console.log('connect'); | |
sensorTag.discoverServices(function() { | |
console.log('discoverServices'); | |
sensorTag.discoverCharacteristics(function() { | |
console.log('discoverCharacteristics'); | |
sensorTag.enableHumidity(function() { | |
sensorTag.on('humidityChange', function(temperature, humidity) { | |
console.log('\ttemperature = %d °C', temperature.toFixed(1)); | |
console.log('\thumidity = %d %', humidity.toFixed(1)); | |
}); | |
sensorTag.notifyHumidity(function() { | |
console.log('notifyHumidity'); | |
}); | |
}); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
using bluez 5.19 on arch linux raspberry pi, running as root.
Code blows up at line 5 since sensorTag is a uuid, not a peripheral.