Skip to content

Instantly share code, notes, and snippets.

@johnnyman727
Created November 5, 2014 17:25
Show Gist options
  • Save johnnyman727/47aac9cafe2702496d5c to your computer and use it in GitHub Desktop.
Save johnnyman727/47aac9cafe2702496d5c to your computer and use it in GitHub Desktop.
Animates a strip of Neopixels according to how loud an environment is.
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