Hi there,
Well, i’ve banged my head against programming now for a few weeks and am getting close to my answer. However, i am still stumped on somethings that, perhaps, one of you may be able to explain to me in plain english.
Below is the code i am having trouble with for my application. Two items are stumping me.
First, I am having a problem sending one motor in the counterclockwise direction for, say, 10 inches, and the other motor in clockwise direction for 14 inches. Can i get my high torque motors to move in increments of approximately 1 inch with the basic atom and the sabertooth 2 x 10 combo?
Second (or in addition to), can i manipulate the code to provide more precision to the motor movements (maybe higher release of current)?
(and i guess a third would be…do i have anything superfulous in my code?)
Any help here would be tremendous.
Thanks and have a good day,
Brian
**counter VAR byte
movemm Var byte
move_left VAR byte
LR_speed VAR byte
UD_speed VAR byte
low 0 'output pin 0 is set to low for positive pulses
low 1 'output pin 1 is set to low for positive pulses
sound 9, [100\880, 100\988, 100\1046, 100\1175]
movemm = 1 'initialize motors
LR_speed = 150 'motor 1 stop value.
UD_speed = 150 'motor 2 stop value.
gosub genpulse '???motor control
movemm = 5 'want the motor to move 5 inches
LR_speed = 100 'motor 1 clockwise
UD_speed = 150 'motor 2 stop value
gosub genpulse '???motor control
pause 1500
movemm = 5 'want the motor to move 5 inches
LR_speed = 200 'motor 1 counter clockwise
UD_speed = 150 'motor 2 stop value
gosub genpulse '???motor control
pause 1500
movemm = 14 'want the motor to move 14 inches
LR_speed = 150 'motor 1 stop value
UD_speed = 200 'motor 2 counterclockwise
gosub genpulse '???motor control
pause 1500
movemm = 1
LR_speed = 150 'Left stop value.
UD_speed = 150 'Right stop value.
gosub genpulse '???motor control
end
genpulse:
for counter = 1 to (30*movemm) 'approx 5 second duration
pulsout 0,(LR_speed * 10) 'does this increase current to motors, perhaps providing more precision?
pulsout 1,(UD_speed * 10) 'does this increase current to motors, perhaps providing more precision?
pause 20 'is this the time it pauses for before running the program?
next
return**