Pololu Dual G2 High-Power Motor Driver 24v14

Hello, Aladin.

As described on the GitHub page for the Python library for the Pololu Dual G2 High-Power Motor Drivers for Raspberry Pi, motor speeds are represented as numbers between -480 and 480. You can specify the speeds using the following functions in that library:

motors.setSpeeds(m1_speed, m2_speed): Set speed and direction for both motor 1 and motor 2.
motors.motor1.setSpeed(speed): Set speed and direction for motor 1.
motors.motor2.setSpeed(speed): Set speed and direction for motor 2.

The example sets up some lists (sequences) of speeds and runs through them so that each motor ramps up from 0 to MAX_SPEED (480) and back down to 0, then in reverse from 0 to -480 and back to 0. To run the motors at a fixed speed, you would just need to call one of the above functions once.

I am not sure I understand your second question. It looks like your program is starting another thread inside the for loop (instead of delaying with time.sleep()), but it is not clear to me what that other thread is doing.

Brandon

1 Like