Created
October 5, 2020 22:09
-
-
Save phkahler/1ddddb79fc57072c4269fdd6716bfb72 to your computer and use it in GitHub Desktop.
Slow smooth blink an LED
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
{ // do this every 1ms or two | |
static int16_t x; | |
static int16_t a; | |
int16_t y = 0x4000 - (((int32_t)x * x) >> 16); | |
a = (a & 0x0fff) + (((int32_t)y * y) >> 16); | |
LED_io_pin = a >> 12; | |
x += 35; // slow blink speed | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment