SolidWorksMagi
Senior Member
Hi,
I can make two motors run, but how do I make the two motors run simultaneously to drive straight forward or backwards?
; 28X2+TB6612FNG+2Motors.bas
#picaxe 28X2
symbol PWMA = C.1 ; B.0 Right Motor Speed Control
symbol PWMB = C.2 ; B.1 Left Motor Speed Control
symbol STBY = C.0 ; B.2 HIGH Allows the H-Bridge to Operate
symbol AIN1 = C.3 ; B.3 Direction Control
symbol AIN2 = C.4 ; B.4 Direction Control
symbol BIN1 = C.5 ; B.5 Direction Control
symbol BIN2 = C.7 ; B.6 Direction Control
symbol Speed = w2
do
Speed = 65000
gosub FWD
loop
end
FWD:
high STBY ;. . . . . . ; C.0
pulsout PWMA, Speed ;.; 'C.2
pulsout PWMB, Speed ;.; 'C.1
low AIN1 ;. . . . . . .; C.3
high AIN2 ;. . . . . .; C.4
high BIN1 ;. . . . . . ; C.5
low BIN2 ;. . . . . . ; C.7
return
end
I also tried;
#picaxe 28X2
symbol PWMA = C.1 ; B.0 Right Motor Speed Control
symbol PWMB = C.2 ; B.1 Left Motor Speed Control
symbol STBY = C.0 ; B.2 HIGH Allows the H-Bridge to Operate
symbol AIN1 = C.3 ; B.3 Direction Control
symbol AIN2 = C.4 ; B.4 Direction Control
symbol BIN1 = C.5 ; B.5 Direction Control
symbol BIN2 = C.7 ; B.6 Direction Control
symbol Speed = w2
Speed = 65000
gosub FWD
do
pulsout PWMA, Speed ;.; 'C.2
pulsout PWMB, Speed ;.; 'C.1
loop
end
FWD:
high STBY ;. . . . . . ; C.0
low AIN1 ;. . . . . . .; C.3
high AIN2 ;. . . . . .; C.4
high BIN1 ;. . . . . . ; C.5
low BIN2 ;. . . . . . ; C.7
return
end
Still, only one motor turns ON at a time ???
I can make two motors run, but how do I make the two motors run simultaneously to drive straight forward or backwards?
; 28X2+TB6612FNG+2Motors.bas
#picaxe 28X2
symbol PWMA = C.1 ; B.0 Right Motor Speed Control
symbol PWMB = C.2 ; B.1 Left Motor Speed Control
symbol STBY = C.0 ; B.2 HIGH Allows the H-Bridge to Operate
symbol AIN1 = C.3 ; B.3 Direction Control
symbol AIN2 = C.4 ; B.4 Direction Control
symbol BIN1 = C.5 ; B.5 Direction Control
symbol BIN2 = C.7 ; B.6 Direction Control
symbol Speed = w2
do
Speed = 65000
gosub FWD
loop
end
FWD:
high STBY ;. . . . . . ; C.0
pulsout PWMA, Speed ;.; 'C.2
pulsout PWMB, Speed ;.; 'C.1
low AIN1 ;. . . . . . .; C.3
high AIN2 ;. . . . . .; C.4
high BIN1 ;. . . . . . ; C.5
low BIN2 ;. . . . . . ; C.7
return
end
I also tried;
#picaxe 28X2
symbol PWMA = C.1 ; B.0 Right Motor Speed Control
symbol PWMB = C.2 ; B.1 Left Motor Speed Control
symbol STBY = C.0 ; B.2 HIGH Allows the H-Bridge to Operate
symbol AIN1 = C.3 ; B.3 Direction Control
symbol AIN2 = C.4 ; B.4 Direction Control
symbol BIN1 = C.5 ; B.5 Direction Control
symbol BIN2 = C.7 ; B.6 Direction Control
symbol Speed = w2
Speed = 65000
gosub FWD
do
pulsout PWMA, Speed ;.; 'C.2
pulsout PWMB, Speed ;.; 'C.1
loop
end
FWD:
high STBY ;. . . . . . ; C.0
low AIN1 ;. . . . . . .; C.3
high AIN2 ;. . . . . .; C.4
high BIN1 ;. . . . . . ; C.5
low BIN2 ;. . . . . . ; C.7
return
end
Still, only one motor turns ON at a time ???
Last edited: