L298N Motor Driver Board Pyboard 6V DC motors

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
johnbanes
Posts: 10
Joined: Fri May 24, 2019 2:32 am

Re: L298N Motor Driver Board Pyboard 6V DC motors

Post by johnbanes » Sun Aug 04, 2019 3:26 am

Having no luck after a few hours trying to move the left motor. I have a left and right motor;

right_motor_en = machine.Pin('X1', machine.Pin.OUT)
right_motor_a = machine.Pin('X2', machine.Pin.OUT)
right_motor_b = machine.Pin('X3', machine.Pin.OUT)

right_pwm_timer = pyb.Timer(2, freq=1000)
right_pwm_channel = right_pwm_timer.channel(1, pyb.Timer.PWM, pin=right_motor_en)
right_pwm_channel.pulse_width_percent(100)

The above code is working for the right motor, I have tried several pin, timer and channel combinations for the left motor. Can you guys suggest what pins to use for the left motor and timer / channel selection? I really don't know what I'm doing :)

Thank you,
John Banes

johnbanes
Posts: 10
Joined: Fri May 24, 2019 2:32 am

Re: L298N Motor Driver Board Pyboard 6V DC motors

Post by johnbanes » Sun Aug 04, 2019 4:04 am

Worked it out by PWMing the enable pin. Thanks!

Post Reply