#include <Adafruit_NeoPixel.h>
int neopixel = 8;
int leds = 16;
Adafruit_NeoPixel ring = Adafruit_NeoPixel(leds,neopixel);
int ldr = A0;
int value = 0;
void setup() {
// put your setup code here, to run once:
ring.begin();
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
//ok
value = analogRead(ldr);
Serial.println(value);
if (value > 1000){
Serial.println("red");
set_color(ring.Color(255,0,0));
}
else if(value > 500){
Serial.println("Yellow");
set_color(ring.Color(255, 255, 0));
}
else{
Serial.println("VERY RANDOM COLOR");
set_color(ring.Color(0, 255, 0));
}
set_color(uint32_t col){
for ( i = 0; i < leds; i ++){
ring.setPixelColor(i,col);
ring.show();
delay(500);
}
}
}