Created
November 6, 2014 19:53
-
-
Save anonymous/af5831eb0a45d3591abf to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ var tessel = require('tessel'); var ambientlib = require('ambient-attx4'); var ambient = ambientlib.use(tessel.port['A']); var rm = 40; ambient.on('ready', function () { // Get points of light and sound data. var int = setInterval( function () { ambient.getLightLevel( function(err, ldata) { if (err) { throw err; clearInterval(int); } var l = Math.min(rm, Math.floor(ldata*10*rm)), m = rm - l; console.log(new Array(l).join('#') + new Array(m).join('.'), l); }) }, 200); // The readings will happen every .5 seconds unless the trigger is hit }); ambient.on('error', function (err) { console.log(err) });