This is a python program to control two DC motors with a L298N H-Bridge motor driver.
The project homepage with many pictures of my Raspberry Pi robots is as follows: https://custom-build-robots.com/
The L298NHBridge.py module has to be imported into your python program to control the two DC motors. The L298NHBridge.py offers the functionality to set the direction and speed of each motor independently. I used a Raspberry Pi and a L298N H-Bridge for my setup. With the RobotControl.py program the speed and direction of the DC motors is set via the keyboard.
This was my first robot I build with a Raspberry Pi and a L298N H-Bridge.
The picture belows shows a typical L298N H-Bridge. With the ENA, IN1, IN2, IN3, IN4 and ENB pins of the motor driver board which are connected with the Raspberry Pi GPIO pins.