OK I've reverted to using a counter to dictate when each case statement is reached. The only issue i have is that for the life of me I can't work out how to slow the B_PWM=B_PWM+1 down so the PWM goes from 0 to 255 over the course of 30 minutes without stopping the clock running (such as would happen if a pause statement was used).
To make this simple I'm going to remove any user programming for now just to make things simple. If anyone can help with some code to assist me in achieving this delay between increasing / decreasing the PWM once every seven seconds without upsetting the clock it would be most appreciated. The timings in the code below are for testing only, so I'm not waiting for things to happen
Code:
If Counter1 < 1200 then
Blue_day_cycle = NIGHT
endif
if Counter1 = 1200 then
Blue_day_cycle = DAWN
endif
if counter1 =1202 then
Blue_day_cycle = DUSK
endif
'*** Do BLUE daily cycle
select case Blue_Day_Cycle
case DAWN
lcdout $FE,$80+13,"DAWN "
B_PWM = B_PWM+1
if B_PWM = b_max then
Blue_Day_Cycle = DAY
endif
case DAY
lcdout $FE,$80+13,"DAY "
Blue_Day_Cycle = DUSK
CASE DUSK
lcdout $FE,$80+13,"DUSK "
if B_PWM > B_Min then
B_PWM = B_PWM - 1
endif
if B_PWM = b_min then
Blue_Day_Cycle = NIGHT
endif
case NIGHT
lcdout $FE,$80+13,"NIGHT"
if HH = S2H and MM = S2M then
Blue_Day_Cycle = DAWN
b_cnt = 0
endif
end select
Bookmarks