Created
August 25, 2025 03:46
-
-
Save extrasleepy/75b8f4b4e427d7a47a3b23a604edeac8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Define pins for the LEDs | |
| #define LED_PIN0 0 | |
| #define LED_PIN1 1 | |
| void setup() { | |
| pinMode(LED_PIN0, OUTPUT); | |
| pinMode(LED_PIN1, OUTPUT); | |
| } | |
| void loop() { | |
| fadeInOut(LED_PIN0); | |
| fadeInOut(LED_PIN1); | |
| } | |
| void fadeInOut(uint8_t pin) { | |
| for (int brightness = 0; brightness <= 254; brightness += 2) { | |
| analogWrite(pin, brightness); | |
| delay(30); | |
| } | |
| for (int brightness = 254; brightness >= 0; brightness -= 2) { | |
| analogWrite(pin, brightness); | |
| delay(30); | |
| } | |
| // Ensure LED is completely off at the end | |
| analogWrite(pin, 0); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment