alexthefox
Senior Member
hi, im new in picaxe microprocessor, and i have a problem:
i want put on 1 out every 30 sec. if input 1 is off, or 3sec off and 1 sec on if input 1 is on until 10 sec.
i wrote the program as follow.
i want to use millisecond to scan pin1 and it dont work. if i replace pause 100... with wait 1 sec it work. there is easy way to write what i wrote?
thank to evrybody, and sorry for my english and my code
b0=0 ; bit conteggio per bip 30 secondi
b1=0 ; bit conteggio per bip ciclo 1 sec ON 3 sec OFF dopo 10 che in=1
main:
if pin1= 1 then
b1=0
goto alarm
else
if b0=>30 then goto attesa
endif
wait 1
let b0=b0+1
goto main
alarm: if pin1= 1 then
pause 100
let b1=b1+1
if b1=>70 then
goto ciclo
else
goto alarm
endif
else
goto main
endif
ciclo:
wait 3
high 2
wait 1
low 2
if pin1=1 then
goto alarm
endif
attesa:
wait 1
high 2
wait 1
low 2
goto main
thk.
Alessandro
i want put on 1 out every 30 sec. if input 1 is off, or 3sec off and 1 sec on if input 1 is on until 10 sec.
i wrote the program as follow.
i want to use millisecond to scan pin1 and it dont work. if i replace pause 100... with wait 1 sec it work. there is easy way to write what i wrote?
thank to evrybody, and sorry for my english and my code
b0=0 ; bit conteggio per bip 30 secondi
b1=0 ; bit conteggio per bip ciclo 1 sec ON 3 sec OFF dopo 10 che in=1
main:
if pin1= 1 then
b1=0
goto alarm
else
if b0=>30 then goto attesa
endif
wait 1
let b0=b0+1
goto main
alarm: if pin1= 1 then
pause 100
let b1=b1+1
if b1=>70 then
goto ciclo
else
goto alarm
endif
else
goto main
endif
ciclo:
wait 3
high 2
wait 1
low 2
if pin1=1 then
goto alarm
endif
attesa:
wait 1
high 2
wait 1
low 2
goto main
thk.
Alessandro