Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Raspberry Pi Robotic Projects

You're reading from   Raspberry Pi Robotic Projects Work through a mix of amazing robotic projects using the Raspberry Pi Zero or the Raspberry Pi 3

Arrow left icon
Product type Paperback
Published in Oct 2016
Publisher
ISBN-13 9781786467966
Length 238 pages
Edition 3rd Edition
Languages
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Jon Witts Jon Witts
Author Profile Icon Jon Witts
Jon Witts
Richard Grimmett Richard Grimmett
Author Profile Icon Richard Grimmett
Richard Grimmett
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Raspberry Pi Robotic Projects - Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Getting Started with the Raspberry Pi FREE CHAPTER 2. Building Your Own Futuristic Robot 3. Building a Wall-E Robot 4. Building a Robotic Fish 5. Creating a Robotic Hand with the Raspberry Pi 6. A Self-Balancing Robot 7. Adding the Raspberry Pi to a Quadcopter

Accessing the USB GPS programmatically


Now that you can access the GPS device, let's work on accessing the data programmatically. Your project should now have the GPS device connected and have access to query the data via the serial port. In this section, you will create a program to use this data to discover where you are, then you can determine what to do with that information.

If you've completed the previous section, you should be able to receive the raw data from the GPS unit. Now you want to be able to do something with this data; for example, find your current location and altitude and then decide whether your target location is to the West, East, North, or South.

First, get the information from the raw data. As noted previously, the position and speed is in the $GPMRC output of the GPS device. Write a program to simply parse out a couple of pieces of information from that data. So, open a new file (you can name it location.py) and edit it, as shown in the following screenshot:

#!/usr...
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 $19.99/month. Cancel anytime
Banner background image