This with gosub works to, but the exactly same thing happens. I tried to put IF ...then condition in body of gosub to examin again but program just not "see" that and go again from the begin.
Here is a new code:
begin:
pause 100 'vrlo bitna pauza'
while tajmer = 1 and rele = 1
goto petlja
petlja:
PAUSE 500
tajmer = 0 'iskljuci tajmer'
portb.1 = 0 'ukljuci crvenu diodu veliku'
pause 3000
gosub petlja1 'iskljuci crvenu diodu
petlja1:
tajmer = 1 'ukljuci tajmer'
portb.1 = 1 'iskljuci crvenu led'
portb.2 = 0 'ukljuci zelenu led'
return
wend 'vrlo bitna pauza'
B0 = 0
button t1,0,255,0,B0,1,ukljucenje 'ako je taster pritisnut idi na ukljucenje'
goto begin
ukljucenje:
tajmer = 1
goto begin
End
The reason for using hardware timer is becouse I don`t know how to make it with microcontroller and potentiometer, maybe that will makes this code easier. In all this code very important information is when timer stops counting(countdown) which is enabled by relay which is similiar to pushbutton on porta.0.
Bookmarks