node-sensor
v0.0.0
Published
node.js lib for Variable Inc.'s NODE sensor
Downloads
4
Maintainers
Readme
node-node-sensor
node.js lib for Variable Inc.'s NODE sensor
Supported modules:
Unsupported modules:
Install
npm install node-sensor
Usage
var NodeSensor = require('node-sensor');
Discover
NodeSensor.discover(callback(nodeSensor));
Connect
nodeSensor.connect(callback);
Disconnect
nodeSensor.disconnect(callback);
Discover Services and Characteristics
nodeSensor.discoverServicesAndCharacteristics(callback);
Setup
nodeSensor.setup(callback);
Kore
nodeSensor.readDeviceName(callback(deviceName));
nodeSensor.readVersion(callback(firmware, model));
nodeSensor.readStatus(callback(batteryLevel, moduleA, moduleB));
nodeSensor.readModuleSubtypes(callback(moduleASubtype, moduleBSubtype));
nodeSensor.readSerials(callback(core, moduleA, moduleB));
nodeSensor.readModuleVersions(callback(moduleAVersion, moduleBVersion));
nodeSensor.readQuietMode(callback(on));
// accelerometer, gyroscope, magnetometer are true/false
// period in ms
nodeSensor.writeKoreMode(accelerometer, gyroscope, magnetometer, period, callback);
Events:
nodeSensor.on('buttonPush', callback);
nodeSensor.on('buttonRelease', callback);
nodeSensor.on('koreAccelerometerReading', callabck(x, y, z));
nodeSensor.on('koreGyroscopeReading', callabck(x, y, z));
nodeSensor.on('koreMagnetometerReading', callabck(x, y, z));
Luma
// mode 0 - 255, 1 bit per LED
nodeSensor.writeLumaMode(mode, callback);
// strobe in Hz
nodeSensor.writeLumaStrobe(strobe, callback);
Clima
// temperaturePressure, humidity, lightProximity are true/false
// period in ms
nodeSensor.writeClimaMode(temperaturePressure, humidity, lightProximity, period, callback)
Events:
// temperature in °C
nodeSensor.on('climaTemperatureReading', callback(temperature));
// pressure in kPa
nodeSensor.on('climaPressureReading', callback(pressure));
// humidity in %
nodeSensor.on('climaHumidityReading', callback(humidity));
// light in lx
nodeSensor.on('climaLightReading', callback(light));
Therma
// ir, led are true/false
// period in ms
nodeSensor.writeThermaMode(ir, led, period, callback);
Events:
// temperature in °C
nodeSensor.on('thermaTemperatureReading', callback(temperature));
Thermocouple
// enable is true/false
// period in ms
nodeSensor.writeThermocoupleMode(enable, period, callback);
Events:
// temperature in °C
nodeSensor.on('thermocoupleTemperatureReading', callback(temperature));
Barcode
Press button to scan barcode.
Events:
nodeSensor.on('barCodeReading', callback(barCode));