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 alaLed.initPWM(11); // set a fading animation with a duration of 2 seconds alaLed.setAnimation(ALA_FADEIN, 2000); } void loop() { // run the animation alaLed.runAnimation(); }
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.
This is so awesomeeeee!
ReplyDeleteHow should I proceed if I want to animated two leds independently?
Thank you so much for this.
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!
ReplyDeleteMy first post. First play with Nano and after a lot of time I managed to get the Blink program working. I have changed code to alter the blink rate.. Wow ! :) Now looking for another led project to download but this on did not work, failed to upload. Can anyone suggest my next nano led based program to run please ?
ReplyDeleteWhere can I get the information about initPWM, setanimation functions? I mean about the arguments of those functions..
ReplyDelete