1.0.3 • Published 5 years ago

sensortag-pg v1.0.3

Weekly downloads
15
License
-
Repository
github
Last release
5 years ago

TI Sensor Tag Node.JS Library (ES6 Class based)

This Library helps to connect, subscribe to data for various sensor services offered by TI SensorTags (http://www.ti.com/tools-software/sensortag.html) over BLE (Bluetooth Low Energy).

Depeneds On

  • noble-device-pg
  • noble

Quick Example

Example file here for CC1350 (Similar to CC2650) is given.

Usage

SensorTagFactory.discoverById(mycc1350Id, type.CC1350, (cc1350) => {
  // Do something with cc1350
});
  • Use wrapper methods of SensorTag.js to instantiate the SensorTag.
cc1350.initiate((error)=>{
  // If error is undefined, it is connected and services are discovered in noble
});
  • Chain services to enable them with specific reading period and an optional callback for (converted) sensor data.
cc1350
  .lux(true, 100)     // Default printing for light sensor
  .ambientTemp(true, 200, (temp)=>{
      // convert temp and print
  });

Advanced

  • To add one or more callbacks, get particular service and call addServiceDataListner.
const luxService = cc1350.luxometerService();
luxService.addListener((luxData)=>{
   // Send over MQTT, REST,  
});