arduino-LEDFader icon indicating copy to clipboard operation
arduino-LEDFader copied to clipboard

Maximum fading time

Open Ivanooe opened this issue 10 years ago • 7 comments

Hello

thank a lot for this library, is very helpful. I have only a question...I saw into the library that you define the interval (time of fading) like an unsigned int. In this way the maximum time that I can set up it's about 65 second. I need an interval like 1 hour... Is possible to change the interval from unsigned int to unsigned long? Or you have choose this type of variable for a specific reason? Thanks in advance.

Ivan

Ivanooe avatar May 15 '15 12:05 Ivanooe

Hi Ivan,

The decision was purely because, for most needs, I didn't expect the interval to be longer than 65 seconds. I don't think it should be a problem for you to change it to a long data type. If you do this, let me know how it works!

Sent from my iPhone

On May 15, 2015, at 5:56 AM, Ivanooe [email protected] wrote:

Hello

thank a lot for this library, is very helpful. I have only a question...I saw into the library that you define the interval (time of fading) like an unsigned int. In this way the maximum time that I can set up it's about 65 second. I need an interval like 1 hour... Is possible to change the interval from unsigned int to unsigned long? Or you have choose this type of variable for a specific reason? Thanks in advance.

Ivan

— Reply to this email directly or view it on GitHub.

jgillick avatar May 18 '15 20:05 jgillick

I tried to do this changement... I modified all the variables from unsigned int to unsigned long, but unluckly I didn't see any improve.

I tried to set up the interval over 70000 and more, but I can't see any difference...It works, but the fade time seems not change.

I don't know....

Ivanooe avatar May 20 '15 14:05 Ivanooe

That's odd. How long does it seem to fade?

jgillick avatar May 26 '15 16:05 jgillick

Another way is dividing millis() to 1000. In this case precision will be in seconds, and max time ~18 hr.

r00tGER avatar Jan 27 '16 17:01 r00tGER

hi all, and thanks jgillick for this great library

the unsigned long method didnt work for me either, but i eventually figured r00tGER dividing the millis();

i made my fader to run up to 600 seconds by dividing all the millis(); in the .cpp file

LINE#108 last_step_time = millis()/10; LINE#140 unsigned long now = millis()/10; LINE#167 last_step_time = millis()/10;

and dividing the MIN_INTERVAL in the .h file as well (default was 20):

LINE#15 #define MIN_INTERVAL 2

now the FADE_TIME is in milliseconds*10 so 2 seconds are now 200 and not 2000 , just to keep in mind

electroc avatar May 10 '16 22:05 electroc

Hi Changing around half a dozen or so unsigned int's to unsigned long within c++ file allows the user to then increase interval time. Worked no problem for me (noob). Thank you jgillick for this library, I have searched a long time and this is ideal for simulating sunrise and sunset in my snake Viv. Kind Regards Gav

GavC666 avatar Feb 04 '18 15:02 GavC666

@GavC666 that makes sense. Mind submitting a pull request with those changes and I'll merge it into the library?

jgillick avatar Feb 04 '18 17:02 jgillick