guys, I have a strange issue which I can't seem to resolve - It's probably my maths, but on paper it seems to work out, but falls over when running.
I have 4 word variables for setting the fade in and fade out duration of the two LEDs, the duration between steps in the duty cycle stems from the assistance I had above. Here's the code
This works fine if the delay is less than an hour. Setting a delay of 0 hours and 59 minutes gives a value for the variable of 13, which is close to the 13.88 seconds when using a calculator. But if I set the duration to 1 hour and zero minutes the value for the variables is shown as 0 and the leds remain at the max setting. My maths suggest it should be 14. (1 hr * 60 = 60 minutes, add zero minutes, total minutes still = 60. * 60 to convert to seconds = 3600 seconds / 255 = 14.11s delay)Code:blue_delay_in = (((fadesetHR[0]*60)+fadesetMN[0])*60)/255 'takes hours and minutes, converts to minutes, then converts to seconds white_delay_in = (((fadesetHR[1]*60)+fadesetMN[1])*60)/255 'takes hours and minutes, converts to minutes, then converts to seconds blue_delay_out = (((fadeoutHR[0]*60)+fadeoutMN[0])*60)/255 'takes hours and minutes, converts to minutes, then converts to seconds white_delay_out = (((fadeoutHR[1]*60)+fadeoutMN[1])*60)/255 'takes hours and minutes, converts to minutes, then converts to seconds
I'm using the following to display the value for these variables, but can't see why it would be that which relates to the issue
Any Ideas guys ?Code:lcdout $FE,$80,"B.FO ",DEC blue_delay_out," W.FO ",dec white_delay_out




Bookmarks