#include <Adafruit_NeoPixel.h>
int neopixel_ring = 9;
int n_leds = 16;
Adafruit_NeoPixel ring = Adafruit_NeoPixel(n_leds, neopixel_ring);
int ldr_pin = 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:
value = analogRead(ldr_pin);
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("Green");
set_color(ring.Color(0,255,0));
}
}
int set_color(uint32_t col){
for(int i=0; i<n_leds; i++){
ring.setPixelColor(i, col);
ring.show();
delay(500);
}
}