I have written some code and it appears to work fine in the simulator, but in practice, it has a problem. It seems to interfere with another section that as far as I can see there is no connection. Maybe there is a better way to do this coding?
start2: ; check reserve tank level and warn if low
do
if pinC.1 = 0 then ; a float switch that is NO and activates when closed
goto reserve_low
else
goto reserve_hi
endif
loop
;if pinC.1 =0 then reserve_low ; white leads
;if pinC.1 =1 then reserve_hi
reserve_hi:
low F_R_LED ; turn off flashing red LED reserve tank normal
goto start2
reserve_low:
high F_R_LED ; turn on flashing red LED reserve tank low
sound 0, (105,50) ; warning sounds through the piezo speaker
sound 0, (110,50)
sound 0, (115,50)
sound 0, (119,50)
goto start2
start2: ; check reserve tank level and warn if low
do
if pinC.1 = 0 then ; a float switch that is NO and activates when closed
goto reserve_low
else
goto reserve_hi
endif
loop
;if pinC.1 =0 then reserve_low ; white leads
;if pinC.1 =1 then reserve_hi
reserve_hi:
low F_R_LED ; turn off flashing red LED reserve tank normal
goto start2
reserve_low:
high F_R_LED ; turn on flashing red LED reserve tank low
sound 0, (105,50) ; warning sounds through the piezo speaker
sound 0, (110,50)
sound 0, (115,50)
sound 0, (119,50)
goto start2