Page 2 of 2

Re: L298N Motor Driver Board Pyboard 6V DC motors

Posted: Sun Aug 04, 2019 3:26 am
by johnbanes
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

Re: L298N Motor Driver Board Pyboard 6V DC motors

Posted: Sun Aug 04, 2019 4:04 am
by johnbanes
Worked it out by PWMing the enable pin. Thanks!