#include <Adafruit_NeoPixel.h>
int dout = 9;
int a0 = A0;
int n = 16;
int intensity = 0;
Adafruit_NeoPixel ring = Adafruit_NeoPixel(n, dout);
void setup() {
// put your setup code here, to run once:
ring.begin();
Serial.begin(9600);
}
int color (uint32_t col){
for(int i = 0; i<n; i++){
ring.setPixelColor(i, col);
ring.show();
delay(500);
}
}
void loop() {
// put your main code here, to run repeatedly:
intensity = analogRead(a0);
Serial.println(intensity);
if(intensity>1000){
Serial.println("red");
color(ring.Color(255,0,0));
}
else if(intensity>500){
Serial.println("yellow");
color(ring.Color(255,255,0));
}
else{
Serial.println("green");
color(ring.Color(0,255,0));
}
}