minhlam
Member level 2
Dear All
I use this code( count by Button) for control direction of motor (picaxe 08m)
Because I don't know much about programming and rarely use it, I don't know how to set the value for Wx.Bx, hope you guys can help me fix the code. I want from 1st pulse to 10th pulse pin 1 is high and from 11 to 20 pin2 is high. But my code value b is not set correctly so the part ( section REV)doesn't runing .I tried using symbol + < > written in many ways but it didn't workSo please guide me to rewrite the equation correctly:
What I must set value B0 for right: Thank you
I use this code( count by Button) for control direction of motor (picaxe 08m)
Because I don't know much about programming and rarely use it, I don't know how to set the value for Wx.Bx, hope you guys can help me fix the code. I want from 1st pulse to 10th pulse pin 1 is high and from 11 to 20 pin2 is high. But my code value b is not set correctly so the part ( section REV)doesn't runing .I tried using symbol + < > written in many ways but it didn't workSo please guide me to rewrite the equation correctly:
What I must set value B0 for right: Thank you
Code:
if b0= 1 to 10 then gosub label
if b0= 11 to 20 then gosub label
and help me fix my code Thank you so much and HAPPY NEW YEAR
/////////////////////////////////////////////////////
;Please help me fix my code or give me new code Thank you
;Picaxe 08m
; pin4 for off pin3 count b1= 1 to 10 pin 1 on off
;pin4 for off pin3 count b1 = 10 to 20 pin 2 on off
main:
, ;COUNT BY BUTTON
if pin3 = 1 and b1 <10 then goto mar
if pin3 = 1 and b1>10 and b1 = 20 then goto rev ; my bad code
if pin4=1 then low 1 low 2 endif
goto main
mar:
if pin3 = 1 and b1 <10 then goto mar
inc b0 inc b1
if b0= 2 then high 1
if pin4=1 then low 1 endif
b0=0
endif
goto main
rev: ; Goto rev not arrived here
if pin3 = 1 and b1 >10 and b1=20 then goto rev
if b0=1 then high 2
if pin4 =1 then low 2
endif endif
let b0=0 let b1 =0
goto main
Last edited by a moderator: