Set value for W and B

lamxe

Senior Member
////////////////////////////////////////////////////////////////////////////
I'm very sorry I didn't know you guys helped me understand this question, so I've re-posted the same question, I hope you can forgive me and delete this request if possible.Thank you so much
//////////////////////////////////////////////////////////////////////////////



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 set not correctly so the part ( section REV)doesn't runing .I tried using symbol + < > written in many ways but it didn't work .So please guide me to rewrite the equation correctly:
What I must set B1 below for right: Thank you
*if b1= 1 to 10 then gosub label ;
*if b1= 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 Count by BUTTON
; pin4 for off pin3 count b1= 1 to 10
;pin4 for off pin3 count b1 = 10 to 20
; pin1 and pin2 on or off for led or ;motor
main:

symbol Pin_in=pin3

if pin3 = 1 and b1 <10 then goto mar ;
;count from 1 to 10
if pin3 = 1 and b1>10 and b1 = 20 then
goto rev ; count 11 to 20 (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:

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:

lbenson

Senior Member
What happens when you single-step your code in the simulator? Where does it go wrong?

Learning to single-step your code in the simulator is probably the best way for you to figure out problems with your code.
 

lamxe

Senior Member
What happens when you single-step your code in the simulator? Where does it go wrong?

Learning to single-step your code in the simulator is probably the best way for you to figure out problems with your code.
Dear Sir Ibenson
Thank you for your attention and guidance and HAPPY NEW YEAR
 
Top