Skip to content

Instantly share code, notes, and snippets.

@vividvilla
Last active December 10, 2015 10:38
Show Gist options
  • Save vividvilla/4422042 to your computer and use it in GitHub Desktop.
Save vividvilla/4422042 to your computer and use it in GitHub Desktop.
LED Fading Effect using Arduino – just like your Sleeping Mac - http://www.electronicsblog.org/led-fading-effect-using-arduino/
const int LED = 9;
int i = 0;
void setup()
{
pinMode(LED, OUTPUT);
}
void loop()
{
for (i = 0; i < 255; i++)
{
analogWrite(LED, i); delay(10);
}
for (i = 255; i > 0; i--)
{
analogWrite(LED, i);
delay(10);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment