1.0.3 • Published 10 years ago

sensortag-shake v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

SensorTag-Shake

Simple shake detection library for the TI SensorTag based on the popular SensorTag package.

Install

npm install --save sensortag-shake

Usage

var SensorTagShake = require('sensortag-shake');

var sensortagshake = new SensorTagShake('+x');

sensortagshake.on('shake', function(data){
	console.log("Shook with ", data.value, "at", data.time);
});

API

Constructor

eg : var sensortagshake = new SensorTagShake(direction, {sensorTag : sensorTagObj});

  • direction: String - The direction of shake to detect. This is a string with sign (+,-) and a coordinate (x,y,z). For eg. '+x'.
  • options : Object - An options object with the folloing optional properties. - sensorTag : Object - A SensorTag object, which has already discovered and connected to a SensorTag hardware. This allows a SensorTag object to be used with multiple libraries. If this optional value is not specified, this constructor will re-discover and re-connect to the SensorTag.

Events

eg : sensortagshake.on('shake', function(data){}

  • The SensorTag object emits a shake event, which contains a data object as defined below.
  • data : Object - Has the following properties. - value : Number - Number indicating the final accelerometer value when the shake was detected. - time : Number - Timestamp (msec) of the detection of the shake. This has (based on the SensorTag HW) minimum granularity of 200msec.
1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago