DrWhoF
Advanced Member level 1
Can someone suggest a simple circuit which turns a device on after a button is pressed for 3s and when the button is pressed for the second time for another 3s turns the device off.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
' pin1 = input [pin6], on/off = output 2 [pin5]
switch off 2
off2:
if pin1 = 1 then cont1
goto off2
cont1:
for b1 = 0 to 9 ' 10*100ms = 1s
pause 100
if pin1 = 1 then cont2
goto off2
cont2:next b1
for b1 = 0 to 9 ' wait 2-nd 1sec
pause 100
if pin1 = 1 then cont3
goto off2
cont3:next b1
for b1 = 0 to 9 ' wait 3-rd 1sec
pause 100
if pin1 = 1 then cont4
goto off2
cont4:next b1
on2: switch on 2
if pin1 = 0 then on3
goto on2
on3: if pin1 = 1 then cont5
goto on3
cont5:
for b1 = 0 to 9
pause 100
if pin1 = 1 then cont6
goto on3
cont6:next b1
for b1 = 0 to 9
pause 100
if pin1 = 1 then cont7
goto on3
cont7:next b1
for b1 = 0 to 9
pause 100
if pin1 = 1 then cont8
goto on3
cont8:next b1
off3: switch off 2
if pin1 = 1 then off3
goto off2
end