Hello I am starting on a project using an arduino uno and a string

Hello

I am starting on a project using an arduino uno and a string of 20 x 36mm pixels (12v) - ws2801 from adafruit.

This is my first arduino project and I am trying to get my head around it all and I have some basic question re: using fastLED to program.

  1. Is it possible to fade each LED up from say 5% to 100% brightness (assume white colour) over a period of 2 minutes. pause it for a minute then fade it back down over 2minutes? I have seen the fadetoblack and other commands but don’t see how duration is applied.

  2. is there limits to the length of time a fade can occur (if possible)?

thanks

If fading is the ONLY thing you were going to do you could use the delay function. 2 mins x 60 seconds x 1000 milliseconds = 120,000, so:
delay(120000) // Delay ~2 minutes

BUT… this is really bad form as it totally blocks the arduino from doing anything else while it just sits there and delays. Absolutely avoid using a really long delay!

A better technique is to keep looping and check the time as it loops. When enough time has passed, have it do something and then keep looping and checking the time again. This allows the arduino to do other things and not be stuck at delay.

Following that example you could replace the LED blink part of it with code to brighten or darken your LED strip.

Since FastLED had a brightness value range of 0-255 you’ll need to figure out how much to step your brightness up or down if you want to go from zero to full 255 in a specified time frame, and then step up or down that amount every so many milliseconds.

You might need some way to keep track of if you’re increasing, holding, or decreasing brightness. For example a variable set to 1 or -1 for increasing or decreasing, and maybe another to specify changing or holding.

Millis will count up for approximately 50 days before it rolls over, so in theory you could have a very long fade up/fade down. :stuck_out_tongue:

My post here might give you other ideas for how to change brightness values.
https://plus.google.com/107904026095248150292/posts/NCAi7YcYQg9

@Mark_Kriegsman is also working on code that allows things to be triggered at specific times but that code is sort of still in the works and on the more advanced side.

thanks so much that gives me a good place to start.