#define LED_PIN 12
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
for (int i=0; i<256; i++){
//设置亮度模拟
analogWrite(LED_PIN, i);
//延时10ms
delay(10);
}
//实现断灭效果
for(int i =255 ; i>=0; i--){
//设置亮度模拟值
analogWrite(LED_PIN, i);
//延时 10ms
delay(10);
}
}