Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
BeagleBone Robotic Projects

You're reading from  BeagleBone Robotic Projects

Product type Book
Published in Dec 2013
Publisher Packt
ISBN-13 9781783559329
Pages 244 pages
Edition 1st Edition
Languages
Author (1):
Richard Grimmett Richard Grimmett
Profile icon Richard Grimmett

Table of Contents (18) Chapters

BeagleBone Robotic Projects
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Getting Started with the BeagleBone Black Programming the BeagleBone Black Providing Speech Input and Output Allowing the BeagleBone Black to See Making the Unit Mobile – Controlling Wheeled Movement Making the Unit Very Mobile – Controlling Legged Movement Avoiding Obstacles Using Sensors Going Truly Mobile – Remote Control of Your Robot Using a GPS Receiver to Locate Your Robot System Dynamics By Land, Sea, and Air Index

Basic programming constructs on the BeagleBone Black


Now that you know how to enter and run a simple Python program on the BeagleBone Black, let's look at some more complex programming constructs. Specifically, we'll cover what to do when we want to decide which instructions to execute and show how to loop our code to do the same thing more than once. I'll give a brief introduction into how to use libraries in the Python code, and how to organize statements into functions. Finally I'll very briefly cover object oriented code organization.

Prepare for lift off

As with the previous section, once you have the basic system and Emacs, you are ready to start coding.

Engage thrusters

As you have seen, your programs normally start with the first line of code and then continue, executing the next line, until your program runs out of code. This is fine, but what if you want to decide between two different courses of action? We can do this in Python using an if statement. Here is some example code:

Here...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}