Pulsout Values to Drive Sabertooth?

Hi,

Sorry if the answer to this is obvious! I’ve tried searching the forum for it but wasn’t able to find the information I needed (at least not in a form I was able to understand, it’s entirely possible I misunderstood or misread posts…).

I’m working on a Tri-Track with the BB2/BAP28 and a Sabertooth 2X5 R/C board. Looking at the PS2/Rover sample code and posts on the forum it is evident that the motors are driven by sending pulsout servo commands to it via pins 0 and 1. I’ve written a simple program to set the motor speed to 0, then three seconds later increase the throttle command slightly, then three seconds later increase it further etc. However, whenever I test it all that happens is that the left motor begins to rotate forwards as soon as the sabertooth is switched on. Nothing else happens throughout the duration of the program.

I was wondering whether someone could please take a look at my code and perhaps spot anything I’m doing wrong?

Also, am I right in thinking that sending a pulse of value 3000 should stop the motors, 4000 to drive them forwards at maximum speed and 2000 to drive them in reverse at max speed?

[code] throttle var byte
loopcount var byte
low p0
low p1

sound 9, [100\880, 100\988, 100\1046, 100\1175]	
	
main
	loopcount = 0
	throttle = 150		' motor stop value
	
	while(loopcount < 5)
		pulsout 0,(throttle*20)	' Left motor.
		pulsout 1,(throttle*20)	' Right motor.
	
		pause(3000)
	
		throttle = throttle + 10		' Throttle value increment.
					
		serout s_out, i9600, " speed = ", throttle]  ' Print throttle value to console
		loopcount = loopcount + 1		' Increment loop counter
	wend

goto main[/code]

Thanks! :smiley:

Lets see the wiring and the switch settings on the 2 x 5. I think the code looks correct.

Hi Jim,

Unfortunately last night after posting this I found that the Sabertooth won’t even power up now. Perhaps the reason my code wasn’t driving the motors is that the Sabertooth was gradually dying? It had the blue power LED but didn’t do anything, and a short while later not even the LED came on. Hopefully my code is correct then, but I’m having to investigate this problem before I can check it again.

Thanks