Scripts for a Raspberry Pi robotics project I worked on.
Raspberry Pi 3 B+
L298n H-bridge motor controller
HC-SR04 ultrasonic distance sensors
Raspberry pi camera module
DC motors and wheels
This module allows control of the GPIO pins and should come pre-installed if you are using Raspbian on your Raspberry Pi. Otherwise, it can be installed with pip:
sudo pip install RPi.GPIO
Installing opencv on the Raspberry Pi can be a bit awkward and can take several hours to install all of the relevant dependencies. This method outlined by Michael Ratcliffe from Hackaday worked fine for me for use in this project, and is much less time consuming:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libcv-dev
sudo apt-get install python-opencv
sudo apt-get install libopencv-dev
sudo apt-get install libcv2.3
sudo apt-get install opencv-doc
A lot of credit goes to Sentdex and Explaining Computers which helped get me going as I was starting the project.