For this Project you will need:
Raspberry Pi 3
Buggy Chassis with motors and wheels
Wire or jumper leads
1 red LED
1 blue LED
2 330 Resistors
Step 1: Connecting Motors to H-Bridge
Loosen the screws in the terminal blocks labeled VCC, GND, and 5V. Take the 9 V battery and Connect the battery clip. The black wire goes into the GND block. It is important that you get this the correct way around otherwise it won't work. The red goes into the VCC Terminal.
You will also need to attach a ground wire to your GND block and connect GND on your breadboard.
Then take the red and black wire from each motor and put it into terminals on the left and right, make sure its held firmly.
On the board used here there are pins labeled In1, In2, In3, and In4. Take a female to male jumper-wire and connect them to the following GPIO pins in order from In1- In4; 25, 18, 23, 24
Step 2: Programming Your Buggy
Copy the Code in the picture above, it doesn't matter if you used different GPIO Pins just change them in the code
Step 3: Connecting VNC Viewer
If you were not already using a Power back to power your pi change to one. Then using tape place the different components on the chassis.
Connect the LEDS, short lead to GND and long head to GPIO pin of your choice.
You will need the VNC Viewer app in order to control your buggy remotely on your device.
Go into the terminal and type, hostname -I and you will be given four numbers, keep them as you would need them later. Then using the app on your device, click "Add Device" and enter the 4 numbers, after that it will ask for a username (pi) and password (raspberry). After that you will be able to control the pi on your device, disconnect the HDMI, and USBS, the only thing connected to your pi should be your power pack. Then connect the 9V battery with the clip and you're all set.
When you run the code on your device click a command in order to move your buggy.