Skip to content

Instantly share code, notes, and snippets.

@mikedamage
Created December 28, 2011 18:47
Show Gist options
  • Save mikedamage/1529134 to your computer and use it in GitHub Desktop.
Save mikedamage/1529134 to your computer and use it in GitHub Desktop.
Functions to make an LED breathe, or "pumm"
void pummOn(int pin, int fadeIncr, int delayTime) {
for (int i = 0; i < 256; i += fadeIncr) {
analogWrite(pin, i);
delayMicroseconds(delayTime);
}
}
void pummOff(int pin, int fadeIncr, int delayTime) {
for (int i = 255; i >= 0; i -= fadeIncr) {
analogWrite(pin, i);
delayMicroseconds(delayTime);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment