const int LED_PIN = 9;
const int BTN_PIN = 2;
void amanecer() { // sunrise
for (int i = 0; i <= 255; i++) {
analogWrite(LED_PIN, i);
delay(100); // Ajusta la velocidad del amanecer
}
}
void anochecer() { // sunset
for (int i = 255; i >= 0; i--) {
analogWrite(LED_PIN, i);
delay(100); // Ajusta la velocidad del anochecer
}
}
void setup() {
Serial.begin(115200);
pinMode(LED_PIN, OUTPUT);
pinMode(BTN_PIN, INPUT_PULLUP);
}
void loop() {
amanecer();
Serial.println("Full on");
delay(2000);
anochecer();
Serial.println("Full off");
delay(2000);
}