tessel-calibrate

0.1.0 • Public • Published

Tessel-Calibrate

Tessel-Calibrate is a lightweight package that allows you to get a buffer of values, plus the high and low, from a number of Tessel modules.

Any module with a method formatted module.method(callback(err, data){ ... }) can be called with calibrate.get(). The resulting values can be accessed via a promise:

calibrate.get().then() 

or as an event:

calibrate.get(); 
calibrate.on(‘calibrated’, callback);

See examples.

Modules supported include:

Calling calibrate.get

The function takes two required arguments, the module you are using and the method name, the latter as a string. Eg: calibrate.get(ambient, ‘getSoundbuffer’);

It also takes an optional options hash, shown below with default values

{ returnsSingle: false,
  calls: 10,
  thresholds: {high: 1, low: 0} } 

Set returnsSingle: true if the method you are calling returns a single value instead of a buffer array, and calibrate will create and return an array for you.

If it is a single return method, you can also choose how many calls to use to create the buffer with calls: num. This will not work with returnSingle: false.

Finally I assume the values returned will be between 0 and 1. If not, set the hight and low thresholds by passing a hash with high and low values to thresholds.

Returned Values

Calibrate always returns a hash with three values:

{ buffer: [], // array of values
  high: .012345,
  low: .000012 } 

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i tessel-calibrate

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • sarahgp