DC Motor Control throttle not working

Play with it! Please tell us which board you're using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
knasman
 
Posts: 1
Joined: Mon Jan 02, 2023 10:20 pm

DC Motor Control throttle not working

Post by knasman »

I have a CPX and I've hooked it up to a DRV8833 motor controller and setting throttle = 0 isn't stopping the motor. Here's the relevant code snippet. It doesn't matter if I set the throttle to .5, .1, or .01 the motor spins full speed. What should I check on?

Thanks,
Keith

Code: Select all

# Create motors                                                                                                                                                                    
PWM_A2 = board.A2
PWM_A3 = board.A3
PWM_FREQ = 25
DECAY_MODE = motor.SLOW_DECAY
positive_pwm1 = pwmio.PWMOut(PWM_A2, frequency=PWM_FREQ)
negative_pwm1 = pwmio.PWMOut(PWM_A3, frequency=PWM_FREQ)
motor_right = motor.DCMotor(positive_pwm1, negative_pwm1)
motor_right.decay_mode = DECAY_MODE

def move_fwd(duration):
    """ Move forward for duration amount of time. """

    print()
    motor_right.throttle = .5
    print("Forward for %s seconds" % duration)
    pixel_control([0, 9], GREEN, 'on')                                                                                                                                               
    time.sleep(duration)
    print()                                                                                                                                                     
    pixel_control([0, 9], GREEN, 'off')
    motor_right.throttle = 0
    
while True:
        move_fwd(.5)
        time.sleep(10)


User avatar
dastels
 
Posts: 15656
Joined: Tue Oct 20, 2015 3:22 pm

Re: DC Motor Control throttle not working

Post by dastels »

Double check your wiring, both logically (are the connections correct) and physically (are the connections good without shorts.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Circuit Playground Classic, Circuit Playground Express, Circuit Playground Bluefruit”