Last active
January 26, 2017 05:33
-
-
Save wtshm/a377583c5f100089e6f10db9bc53b6e1 to your computer and use it in GitHub Desktop.
This file contains 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 LED_PIN 9 | |
void setup() { | |
pinMode(LED_PIN, OUTPUT); | |
} | |
void loop() { | |
pulseLED(); | |
// breatheLED(); | |
} | |
void pulseLED() { | |
float val = 128.0 + 128 * sin((millis() / 1000.0) * PI); | |
analogWrite(LED_PIN, val); | |
} | |
void breatheLED() { | |
float val = (exp(sin(millis() / 2000.0 * PI)) - 0.36787944) * 108.0; | |
analogWrite(LED_PIN, val); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment