Dear All
I wrote this code for the driver motor of the solenoid coil machine but it doesn't work. Please help me correct it for working many thank you.
Best regards
lam
#Picaxe 08M
Symbol PIN_IN = pin3
Symbol counter = b0
main:
if b1<30 then forw
if b1>30 then bak
goto main
forw:
Gosub WaitForPulse
inc b0
inc b1
if b0=2 then high 1 low 2
endif
if pin4=1 then low 1 low 2
endif
b0=0
goto main
bak:
Gosub WaitForPulse
inc b1
inc b0
if b0=2 then high 2 low 1
endif
if pin4=1 then low 2 low 1
endif
b0=0
goto main
Gosub WaitForPulse
goto main
rese:
b1=0; loop for new cycle
goto main
WaitForPulse:
Do : Loop While PIN_IN =1
Do : Loop Until PIN_IN = 1
Return
I wrote this code for the driver motor of the solenoid coil machine but it doesn't work. Please help me correct it for working many thank you.
Best regards
lam
#Picaxe 08M
Symbol PIN_IN = pin3
Symbol counter = b0
main:
if b1<30 then forw
if b1>30 then bak
goto main
forw:
Gosub WaitForPulse
inc b0
inc b1
if b0=2 then high 1 low 2
endif
if pin4=1 then low 1 low 2
endif
b0=0
goto main
bak:
Gosub WaitForPulse
inc b1
inc b0
if b0=2 then high 2 low 1
endif
if pin4=1 then low 2 low 1
endif
b0=0
goto main
Gosub WaitForPulse
goto main
rese:
b1=0; loop for new cycle
goto main
WaitForPulse:
Do : Loop While PIN_IN =1
Do : Loop Until PIN_IN = 1
Return
#Picaxe 08M
Symbol PIN_IN = pin3
Symbol counter = b0
main:
if b1<5 then forw
if b1>5 then bak
if b1=10 then rese
goto main
forw:
Gosub WaitForPulse
inc b0
inc b1
if b0=2 then high 1 low 2
endif
if pin4=1 then low 1 low 2
endif
b0=0
goto main
bak:
Gosub WaitForPulse
inc b1
inc b0
if b0=2 then high 2 low 1
endif
if pin4=1 then low 2 low 1
endif
b0=0
goto main
Gosub WaitForPulse
goto main
rese:
b1=0; loop for new cycle
goto main
WaitForPulse:
Do : Loop While PIN_IN =1
Do : Loop Until PIN_IN = 1
Return
Last edited: