I'm finally at the point where I get to put all my NeoPixels into place and get them wired up. The only sensor that I will be using is the photocell. It's purpose is to detect the light levels and turn off the NeoPixel sequence, if the environment is too bright. I had a bit of a problem after soldering the NeoPixels into place, but with Wayne's help, we were able to overcome it.
Here's a video going over my discoveries and progress:
I used the Adafruit NeoPixel strip loop coding with just a few changes. Here is the final code that I will be using:
#include <Adafruit_NeoPixel.h>
#define PIN 0
int photocell = 1;
int photocellReading;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(7, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(photocell, INPUT);
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
//read photocell looking for unlit room
photocellReading = analogRead(photocell);
//lighting is dim, run the neopixels
if(photocellReading < 300){
colorWipe(strip.Color(255, 0, 0), 0); // Red
delay(3000);
colorWipe(strip.Color(0, 0, 255), 0); // Blue
delay(3000);
colorWipe(strip.Color(0, 255, 0), 0); // Green
delay(3000);
colorWipe(strip.Color(110, 0, 140), 0); // Purple
delay(3000);
colorWipe(strip.Color(217, 187, 1), 0); // Gold
delay(3000);
}else{
//lighting is bright, shut down the neopixels
colorWipe(strip.Color(0,0,0),0);
delay(5000);
}
}
// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint16_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}
-
DAB
-
Cancel
-
Vote Up
0
Vote Down
-
-
Sign in to reply
-
More
-
Cancel
Comment-
DAB
-
Cancel
-
Vote Up
0
Vote Down
-
-
Sign in to reply
-
More
-
Cancel
Children