#include
#define LED_PIN 6
#define LED_NUM 2
#define Light_PIN A0
ColorLED strip = ColorLED(LED_NUM,LED_PIN);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(Light_PIN,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int Light = analogRead(Light_PIN);
if (Light > 800){
strip.setPixelColor(0,255,0,0);
strip.show();
delay(2000);
} else {
strip.setPixelColor(0,0);
strip.show();
}
Serial.print("Light=");
Seriai.println(Light);
delay(100);
}
立即注册