tessel-plops-logger
v2.0.0
Published
Logs the plops of a beer fermentation.
Downloads
7
Readme
tessel-plops-logger
Logs the plops of a beer fermentation. Like so.
Usage
var tessel = require('tessel');
var ambientLib = require('ambient-attx4');
var ambient = ambientLib.use(tessel.port.B);
var options = {
debug: true, // Whether or not to spit out all kinds of debug messages.
interval: 3, // Interval for sending data back (in s.)
ledNumber: 1, // The led number on the tessel to light up when sensing a plop.
level: 0.017, // The volume level to trigger the sound trigger.
maxLevel: 0.1, // The max volume level (higher sounds will be ignored).
plopCallback: function (err, data) {} // Callback that will be called on every plop.
};
var tpl = require('tessel-plops-logger')(ambient, options, tessel);
var numberOfChecks = 0;
// Function to call at every interval end.
function onIntervalEnd(err, plops) {
console.log('Plops per 3s at %s is %d', new Date(), plops);
numberOfChecks++;
if (numberOfChecks > 3) {
// This will stop the interval based checks.
tpl.stop();
}
}
tpl.start(onIntervalEnd);