Reader small image

You're reading from  Getting Started with Raspberry Pi Zero

Product typeBook
Published inMar 2016
Reading LevelIntermediate
Publisher
ISBN-139781786469465
Edition1st Edition
Languages
Right arrow
Author (1)
Richard Grimmett
Richard Grimmett
author image
Richard Grimmett

Dr. Richard Grimmett has been fascinated by computers and electronics from his very first programming project, which used Fortran on punch cards. He has bachelor's and master's degrees in electrical engineering and a PhD in leadership studies. He also has 26 years of experience in the radar and telecommunications industries, and even has one of the original brick phones. He now teaches computer science and electrical engineering at Brigham Young University, Idaho, where his office is filled with his many robotics projects.
Read more about Richard Grimmett

Right arrow

Controlling your mobile platform programmatically using the Raspberry Pi Zero


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...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Getting Started with Raspberry Pi Zero
Published in: Mar 2016Publisher: ISBN-13: 9781786469465

Author (1)

author image
Richard Grimmett

Dr. Richard Grimmett has been fascinated by computers and electronics from his very first programming project, which used Fortran on punch cards. He has bachelor's and master's degrees in electrical engineering and a PhD in leadership studies. He also has 26 years of experience in the radar and telecommunications industries, and even has one of the original brick phones. He now teaches computer science and electrical engineering at Brigham Young University, Idaho, where his office is filled with his many robotics projects.
Read more about Richard Grimmett