Hello,
I am looking at being able to write a program which can turn on and off an output from one switch, the switch has to be push button only, not latching.
So press 1 = ON and press 2 = OFF then press 3 = ON etc...
The program i want to use is:
b1 = 0
checkforsignal:
if pin1 = 1 then
b1 = b1 + 1
goto process
end if
pause 250
goto checkforsignal
process:
if b1 = 1 then
high 4
b1 = 0
goto checkforsignal
end if
if b1 <> 1 then
low 4
b1 = 0
goto checkforsignal
end if
but all what seems to happen is it, turns the output on and off very fast
please say where i am going wrong.
Thanks
 
Edited by - MiB1986 on 14/08/2007 15:04:01
I am looking at being able to write a program which can turn on and off an output from one switch, the switch has to be push button only, not latching.
So press 1 = ON and press 2 = OFF then press 3 = ON etc...
The program i want to use is:
b1 = 0
checkforsignal:
if pin1 = 1 then
b1 = b1 + 1
goto process
end if
pause 250
goto checkforsignal
process:
if b1 = 1 then
high 4
b1 = 0
goto checkforsignal
end if
if b1 <> 1 then
low 4
b1 = 0
goto checkforsignal
end if
but all what seems to happen is it, turns the output on and off very fast
please say where i am going wrong.
Thanks
 
Edited by - MiB1986 on 14/08/2007 15:04:01