Created
December 14, 2014 20:25
-
-
Save judoole/279b717cb6fd2d5e85b8 to your computer and use it in GitHub Desktop.
Node Sensortag
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'); | |
connect_and_enable_humidity = function(sensorTag){ | |
console.log('discovered %s', sensorTag); | |
sensorTag.connect(function() { | |
console.log('connected'); | |
sensorTag.discoverServicesAndCharacteristics(function() { | |
console.log('Discovering services') | |
sensorTag.enableIrTemperature(function(){ | |
sensorTag.on('irTemperatureChange', function(objectTemperature, ambientTemperature){ | |
console.log('\tobjectTemperature = %d °C', objectTemperature.toFixed(1)); | |
console.log('\tambientTemperature = %d °C', ambientTemperature.toFixed(1)); | |
}); | |
sensorTag.notifyIrTemperature(function(){ | |
console.log('Temp changed') | |
}); | |
}); | |
}); | |
}); | |
} | |
SensorTag.discover(connect_and_enable_humidity, '643b7b6121e14684a5d2aa0af93e7cd3'); | |
console.log('Starting to discover') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just a gist of a code I used to get some temperature readings from a Texas SensorTag