Now that you have your basic motor controller functionality up and running, you need to connect both motor controllers to the Raspberry Pi Zero. This section will cover this and also show you how to control your entire platform programmatically.
You are going to use Python in your initial attempts to control the motor. It is very straightforward to code, run, and debug your code in Python. The first Python program you are going to create is shown in the following screenshot:
Perform the following steps to create this program:
To create this program, create a directory called dcmotor
in your home directory by typing mkdir dcmotor
and then type cd dcmotor
. Now, open the file by typing emacs dcmotor.py
(if you are using a different editor, open a new file with the dcmotor.py
name).
Now, enter the program. Let's go through the program step by step:
#!/usr/bin/python
: This line lets you run the program without having to...