Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ambient Overnight Capture
// Ambient Overnight test
var tessel = require('tessel'),
ambientLib = require('ambient-attx4'),
ambient = ambientLib.use(tessel.port['B']);
ambient.on('ready', function() {
// Check light every five minutes
setInterval(function() {
ambient.getLightLevel(function(err, lightData) {
console.log(new Date(), 'Light level: ', lightData.toFixed(8));
});
}, 300000);
});
ambient.on('error', function (err) {
console.log(err)
});
Mon Jun 16 2014 06:47:40 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:52:40 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 06:57:40 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 07:02:40 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 07:07:40 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 07:12:40 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 07:17:40 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 07:22:40 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 07:27:40 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 07:32:40 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 07:37:40 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:31:05 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:36:05 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 06:41:05 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:46:05 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:51:05 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:56:05 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 07:01:05 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:28:26 GMT+0000 (GMT) Light level: 0.00976562 xxx
Mon Jun 16 2014 06:28:26 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 06:28:26 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:28:26 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:28:26 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:28:26 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 06:28:26 GMT+0000 (GMT) Light level: 0.00976562 xxx
Mon Jun 16 2014 06:29:30 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:34:30 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:39:30 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:44:30 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:49:30 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 06:54:30 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:59:30 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 07:04:30 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 07:09:30 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 07:14:30 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 07:19:30 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 07:24:30 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 07:29:30 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 07:34:30 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 06:27:55 GMT+0000 (GMT) Light level: 0.00976562
Mon Jun 16 2014 06:32:55 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 06:37:55 GMT+0000 (GMT) Light level: 0.01074219
Mon Jun 16 2014 07:17:04 GMT+0000 (GMT) Light level: 0.01269531 xxx
Mon Jun 16 2014 07:17:04 GMT+0000 (GMT) Light level: 0.01269531
Mon Jun 16 2014 07:17:04 GMT+0000 (GMT) Light level: 0.01269531
Mon Jun 16 2014 07:17:04 GMT+0000 (GMT) Light level: 0.01269531
Mon Jun 16 2014 07:17:04 GMT+0000 (GMT) Light level: 0.01269531
Mon Jun 16 2014 07:17:04 GMT+0000 (GMT) Light level: 0.01269531
Mon Jun 16 2014 07:17:04 GMT+0000 (GMT) Light level: 0.01269531
Mon Jun 16 2014 07:17:55 GMT+0000 (GMT) Light level: 0.01269531 xxx
Mon Jun 16 2014 07:22:55 GMT+0000 (GMT) Light level: 0.01367188
Mon Jun 16 2014 07:27:55 GMT+0000 (GMT) Light level: 0.01367188
Mon Jun 16 2014 07:32:55 GMT+0000 (GMT) Light level: 0.01367188
Mon Jun 16 2014 07:37:55 GMT+0000 (GMT) Light level: 0.01464844
Mon Jun 16 2014 06:31:20 GMT+0000 (GMT) Light level: 0.01464844
Mon Jun 16 2014 06:36:20 GMT+0000 (GMT) Light level: 0.01464844
Mon Jun 16 2014 06:41:20 GMT+0000 (GMT) Light level: 0.01562500
Mon Jun 16 2014 06:46:20 GMT+0000 (GMT) Light level: 0.01562500
Mon Jun 16 2014 06:51:20 GMT+0000 (GMT) Light level: 0.01562500
Mon Jun 16 2014 06:56:20 GMT+0000 (GMT) Light level: 0.01562500
Mon Jun 16 2014 07:01:20 GMT+0000 (GMT) Light level: 0.01562500
Mon Jun 16 2014 07:06:20 GMT+0000 (GMT) Light level: 0.01660156
Mon Jun 16 2014 07:11:20 GMT+0000 (GMT) Light level: 0.01660156
Mon Jun 16 2014 07:16:20 GMT+0000 (GMT) Light level: 0.01660156
Mon Jun 16 2014 07:21:20 GMT+0000 (GMT) Light level: 0.01660156
Mon Jun 16 2014 07:26:20 GMT+0000 (GMT) Light level: 0.01660156
Mon Jun 16 2014 07:31:20 GMT+0000 (GMT) Light level: 0.01660156
Mon Jun 16 2014 06:54:06 GMT+0000 (GMT) Light level: 0.01757812 xxx
Mon Jun 16 2014 06:54:06 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 06:54:06 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 06:54:07 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 06:54:07 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 06:54:07 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 06:54:45 GMT+0000 (GMT) Light level: 0.01757812 xxx
Mon Jun 16 2014 06:59:45 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 07:04:45 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 07:09:45 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 07:14:45 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 07:19:45 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 07:24:45 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 07:29:45 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 07:34:45 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 06:28:10 GMT+0000 (GMT) Light level: 0.01660156
Mon Jun 16 2014 06:33:10 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 06:38:10 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 06:43:10 GMT+0000 (GMT) Light level: 0.01757812
Mon Jun 16 2014 06:48:10 GMT+0000 (GMT) Light level: 0.01757812
// Ambient Overnight test
var tessel = require('tessel'),
ambientLib = require('ambient-attx4'),
ambient = ambientLib.use(tessel.port['B']),
moment = require('moment');
ambient.on('ready', function() {
console.log('ready');
// Check light every five minutes
setInterval(function() {
ambient.getLightLevel(function(err, lightData) {
console.log('logging');
console.log(moment().format(), 'Light level:', lightData.toFixed(8));
});
}, 3000);
});
ambient.on('error', function (err) {
console.log(err)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.