ALA Example - SimpleLed

This is the simplest example for the ALA library. It is showing how to make a simple fading animation effect using a LED driven by an Arduino PWM output.

The sketch is very simple. Only three lines of code.

#include <AlaLed.h>

AlaLed alaLed;

void setup()
  // initialize the led attached to pin 11 with PWM driver
  // set a fading animation with a duration of 2 seconds
  alaLed.setAnimation(ALA_FADEIN, 2000);

void loop()
  // run the animation

The circuit is the same used in the Blink example but the LED must be connected to pin 11.

The ALA library provides many nice animations. Try changing the animation type with ALA_BLINK or ALA_GLOW.

You are now ready to move to the MultiLedSequence example.


  1. This is so awesomeeeee!
    How should I proceed if I want to animated two leds independently?
    Thank you so much for this.

  2. found out how in further reading your posts :) also found info about how to change animation in a comment you responded, would switching an animation be done smoothly? for example a led is fading in and the animation switched to, calls it to fade out, would the led fade starting exactly where the current animation has the brightness and then fades out or it will abruptly lit and then fade out? Thanks a Zillion!