markhuntxxy
New Member
Appologies first for the stupid question, but been pulling my hair out for a while on this and don't seem to be getting anywhere!!
The main problem is my lack of understanding of how to control the speed and direction of 2 motors on my PICAXE MICRO-ROBOT. I've read, re-read and read again the AXE120 manual (Section 9) but still faill to get my robot to follow a line in a controlled manner. The manual says I should use a pulsout command but I don't seem to be having any success.
Can I use this "pulsout" command to set the forward speed also?
The code I am using is below, but I am obviously making a blunder somewhere! I'm using a picaxe 28 with line follower board, using inputs 1,2 and 6. The Motors are controlled by outputs 4,5,6and7.
Please help!!!
init:
pause 100 'motor controller start up pause
let b1=pin1
let b2=pin2
let b6=pin6
main:
if pin1 = 1 then go_forward
if pin2 = 1 then go_left 'turn left
if pin6 = 1 then go_right 'turn right
goto go_stop
go_forward:
Pause 100 'Pause for 100ms
let pins = %10100000 'go forward
goto main
go_left:
Pause 100 'Pause for 100ms
let pins = %00110000 'go left
pulsout 6,50 'pulses Left Speed
goto main
go_right:
Pause 100 'Pause for 100ms
let pins = %11000000 'go right
pulsout 4,50 'pulses Right Speed
return
go_stop:
Pause 100
let pins = %00000000 'stop - not over line!
goto main
The main problem is my lack of understanding of how to control the speed and direction of 2 motors on my PICAXE MICRO-ROBOT. I've read, re-read and read again the AXE120 manual (Section 9) but still faill to get my robot to follow a line in a controlled manner. The manual says I should use a pulsout command but I don't seem to be having any success.
Can I use this "pulsout" command to set the forward speed also?
The code I am using is below, but I am obviously making a blunder somewhere! I'm using a picaxe 28 with line follower board, using inputs 1,2 and 6. The Motors are controlled by outputs 4,5,6and7.
Please help!!!
init:
pause 100 'motor controller start up pause
let b1=pin1
let b2=pin2
let b6=pin6
main:
if pin1 = 1 then go_forward
if pin2 = 1 then go_left 'turn left
if pin6 = 1 then go_right 'turn right
goto go_stop
go_forward:
Pause 100 'Pause for 100ms
let pins = %10100000 'go forward
goto main
go_left:
Pause 100 'Pause for 100ms
let pins = %00110000 'go left
pulsout 6,50 'pulses Left Speed
goto main
go_right:
Pause 100 'Pause for 100ms
let pins = %11000000 'go right
pulsout 4,50 'pulses Right Speed
return
go_stop:
Pause 100
let pins = %00000000 'stop - not over line!
goto main