Skip to content

Instantly share code, notes, and snippets.

@bigjosh
Last active June 20, 2017 19:31
Show Gist options
  • Save bigjosh/63e344ea41e134140a989a3149a4d793 to your computer and use it in GitHub Desktop.
Save bigjosh/63e344ea41e134140a989a3149a4d793 to your computer and use it in GitHub Desktop.
Breathing LED for Arduino or AVR C. Adafuit profile. Data in flash.
#include <avr/pgmspace.h>
const PROGMEM uint8_t breath_data[] = {
64, 68, 72, 76, 81, 85, 90, 95, 100, 105, 110, 116, 121, 127, 132, 138,
144, 150, 156, 163, 169, 176, 182, 189, 196, 203, 211, 218, 225, 233, 241, 249,
255, 249, 241, 233, 225, 218, 211, 203, 196, 189, 182, 176, 169, 163, 156, 150,
144, 138, 132, 127, 121, 116, 110, 105, 100, 95, 90, 85, 81, 76, 72, 68
};
#define BREATH_LEN (sizeof( breath_data) / sizeof( *breath_data ))
uint8_t breath(uint8_t step) {
uint8_t brightness = pgm_read_byte_near( breath_data + step);
return brightness;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment