Category Archives: Compressor

Neopixel VU Meter

Adafruit Neopixels

And so it begins, this is part of a project that I am starting that is a embedded 1176 like compressor. I wanted to start off with the easy part and play around with this neopixles from Adafruit they can be found here Adafruit Neopixels. Heres what I came up with so far.

 

Code:

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRB + NEO_KHZ800);
int ammount=0;

void setup() {
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
}

void loop() {

//int brightness=analogRead(A0); //Variable Brightness
//brightness = map(brightness, 0, 1023, 0, 50);

ammount = analogRead(A0);
ammount =map(ammount,0,1023,0,8);

if (ammount <4){
colorWipe(strip.Color(0, 150, 0), 1); // Red
colorWipe(strip.Color(0, 0, 0, 255), 1); // White RGBW

}
if (ammount <6){
colorWipe(strip.Color(75, 75, 0), 1); // Red
colorWipe(strip.Color(0, 0, 0, 255), 1); // White RGBW

}
if (ammount >=6){
colorWipe(strip.Color(75, 0, 0), 1); // Red
colorWipe(strip.Color(0, 0, 0, 255), 1); // White RGBW
}
}

void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<ammount; i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}

More to come!