Book Image

Intel Galileo Essentials

Book Image

Intel Galileo Essentials

Overview of this book

Table of Contents (15 chapters)
Intel Galileo Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a program in Linux so that you can control your quadruped


You now know that you can talk to your servo motor controller, and move your servos. In this section, you'll create a python program that will let you talk to your servos to move them to specific angles. You'll use python as it is very simple and easy to run.

Let's start with a simple program that will make your legged mobile robot's servos go to 90 degrees (this should be somewhere close to the middle of the 0 to 180 degrees you can set.) If you are unfamiliar with the editing code in Linux, the best source is a tutorial on the editor you are using. For nano try http://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/. Here is the code:

Here is an explanation of the code:

  1. #!/usr/bin/python:- This first line allows you to make this python file execute from the command line.

  2. import serial:– This line imports the serial library. You need the serial library to talk to your unit via USB...