Basic Pros Drive

After messing around with PROS IDE a bit, I made a couple of programs, the main one that I wanted to check that I was doing right was controlling motors using the joysticks.

Is it in any way possible that someone could send me a basic tank drive code to check off some of my code?

Thanks a ton!

#include "main.h"

void lDriveSet(int control){
	motorSet(2, control);
	motorSet(1, -control);
void rDriveSet(int control){
	motorSet(9, -control);
	motorSet(10, control);

void operatorControl() {
	while (true)
		//set drive motors with a deadband of 5
		if(abs(joystickGetAnalog(1,3)) > 5)
		if(abs(joystickGetAnalog(1,2)) > 5)


from GitHub - Highway-Man/ALBA-OSSR: ALBA's Open Source Starstruck Robot

1 Like

What is the abs doing in your code?

It’s a deadband, so if the joystick is between -5 and 5, the motors get set to 0. This prevents the motors from making a high-pitched whining when the robot is on and not moving.

That part of the code checks if the joystick is between -5 and 5 and doesn’t power the motor with those low values. It is a deadband to stop the motors from getting power that you don’t mean to send.

Cool! Thanks for helping me out, I really like pros so far.

Thanks a ton, that really cleared things up for me.

Does this work for V5 as well?

1 Like