Created
November 5, 2014 17:25
-
-
Save johnnyman727/47aac9cafe2702496d5c to your computer and use it in GitHub Desktop.
Animates a strip of Neopixels according to how loud an environment is.
This file contains 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 characters
var tessel = require('tessel'); | |
var ambientLib = require('ambient-attx4'); | |
var animations = require('neopixel-animations'); | |
var Neopixels = require('neopixels'); | |
var neopixels = new Neopixels(); | |
var ambient = ambientLib.use(tessel.port.A); | |
var numLEDs = 60; | |
var helpFactor = 10; | |
ambient.on('ready', function() { | |
ambient.on('sound', function(levels) { | |
var level = levels[0] * helpFactor; | |
neopixels.animate(numLEDs, animations.progressBar(numLEDs, 'blue', level)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment