I want to control 4 DC Motors from a Raspberry Pi. I am just starting by making sure that 1 motor can be controlled. I am following this guide: https://projects.raspberrypi.org/en/projects/physical-computing/14, which explains the wiring configuration for the motor control board to the motor, and how to use the Motor class in the gpiozero library.
I have connected the Motor Control Board powered by dual H-bridge IC L293D http://shop.sb-components.co.uk/products/motorshield-for-raspberry-pi to the Raspberry Pi, and the battery box to the motor control board (switched on). When directly connecting my DC motor to the battery box, the motor spins very fast, so I know that it works. The motor has 2 wires (black and red) which I connect to the holes for Motor 1 on the motor control board as follows:
I am also following the pin documentation for the motor control board:
After everything is connected, I run the following code on the Raspberry Pi (using user Vadim's suggestion):
from gpiozero import Motor motor1 = Motor(forward=15, backward=13, enable=11) while True: motor1.forward()
However, the motor does not move at all. I was a bit confused by the pin description, as I am not sure what the distinction between 'enable' and 'control' is, as they have a total of 3 GPIO pins (11, 13, and 15), but I have only 2 wires on my motor.
However, I have tried every combination of GPIO values into my code above: Motor(11, 15, 13), Motor(15, 11, 13), Motor(13, 11, 15), etc. None of them get the motor to move. Am I missing something? Should I be directly connecting the motor wires to the pins of the motor controller board? Or something else?