thethingbox-sensortag
v0.0.6
Published
node.js lib for the TI SensorTag
Downloads
6
Maintainers
Readme
node-sensortag
node.js lib for the TI SensorTag
Forked from https://github.com/sandeepmistry/node-sensortag.
Install
npm install sensortag
Usage
var SensorTag = require('sensortag');
Discover
SensorTag.discover(callback(sensorTag)[, uuid]);
Optional SensorTag uuid
to scan for, obtained from previous discover sensorTag.uuid
.
The uuid
per SensorTag may not be the same across machines.
Connect
sensorTag.connect(callback);
Disconnect
sensorTag.disconnect(callback);
Discover Services and Characteristics
sensorTag.discoverServicesAndCharacteristics(callback);
Device Info
sensorTag.readDeviceName(callback(deviceName));
sensorTag.readSystemId(callback(systemId));
sensorTag.readSerialNumber(callback(serialNumber));
sensorTag.readFirmwareRevision(callback(firmwareRevision));
sensorTag.readHardwareRevision(callback(hardwareRevision));
sensorTag.readSoftwareRevision(callback(softwareRevision));
sensorTag.readManufacturerName(callback(manufacturerName));
IR Temperature Sensor
Enable/disable:
sensorTag.enableIrTemperature(callback);
sensorTag.disableIrTemperature(callback);
Read:
sensorTag.readIrTemperature(callback(objectTemperature, ambientTemperature));
Notify/Unnotify:
sensorTag.notifyIrTemperature(callback);
sensorTag.unnotifyIrTemperature(callback);
sensorTag.on('irTemperatureChange', callback(objectTemperature, ambientTemperature));
Accelerometer
Enable/disable/configure:
sensorTag.enableAccelerometer(callback);
sensorTag.disableAccelerometer(callback);
sensorTag.setAccelerometerPeriod(period, callback); // period 1 - 2550 ms, default period is 2000 ms
Read:
sensorTag.readAccelerometer(callback(x, y, z));
Notify/Unnotify:
sensorTag.notifyAccelerometer(callback);
sensorTag.unnotifyAccelerometer(callback);
sensorTag.on('accelerometerChange', callback(x, y, z));
Humidity Sensor
Enable/disable:
sensorTag.enableHumidity(callback);
sensorTag.disableHumidity(callback);
Read:
sensorTag.readHumidity(callback(temperature, humidity));
Notify/Unnotify:
sensorTag.notifyHumidity(callback);
sensorTag.unnotifyHumidity(callback);
sensorTag.on('humidityChange', callback(temperature, humidity));
Magnetometer
Enable/disable:
sensorTag.enableMagnetometer(callback);
sensorTag.disableMagnetometer(callback);
sensorTag.setMagnetometerPeriod(period, callback); // period 1 - 2550 ms, default period is 2000 ms
Read:
sensorTag.readMagnetometer(callback(x, y, z));
Notify/Unnotify:
sensorTag.notifyMagnetometer(callback);
sensorTag.unnotifyMagnetometer(callback);
sensorTag.on('magnetometerChange', callback(x, y, z));
Barometric Pressure Sensor
Enable/disable:
sensorTag.enableBarometricPressure(callback);
sensorTag.disableBarometricPressure(callback);
Read:
sensorTag.readBarometricPressure(callback(pressure));
Notify/Unnotify:
sensorTag.notifyBarometricPressure(callback);
sensorTag.unnotifyBarometricPressure(callback);
sensorTag.on('barometricPressureChange', callback(pressure));
Gyroscope
Enable/disable:
sensorTag.enableGyroscope(callback);
sensorTag.disableGyroscope(callback);
Read:
sensorTag.readGyroscope(callback(x, y, z));
Notify/Unnotify:
sensorTag.notifyGyroscope(callback);
sensorTag.unnotifyGyroscope(callback);
sensorTag.on('gyroscopeChange', callback(x, y, z));
Simple Key
Notify/Unnotify:
sensorTag.notifySimpleKey(callback);
sensorTag.unnotifySimpleKey(callback);
sensorTag.on('simpleKeyChange', callback(left, right));