Skip to content

Instantly share code, notes, and snippets.

@J3698
Last active May 7, 2019 21:55
Show Gist options
  • Save J3698/ff73c5da9a8aa8ff3dc7a54066caf4c5 to your computer and use it in GitHub Desktop.
Save J3698/ff73c5da9a8aa8ff3dc7a54066caf4c5 to your computer and use it in GitHub Desktop.
void update_lights(bool beat_detected) {
static uint8_t blueness = 0;
if (beat_detected) {
blueness = MAX_BRIGHTNESS;
} else if (blueness >= BRIGHTNESS_DECAY) {
blueness = blueness - BRIGHTNESS_DECAY;
} else {
blueness = 0;
}
APA102_Fill(led_strip, APA102_CreateFrame(STRIP_BRIGHTNESS, 0, 0, blueness));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment