Search icon CANCEL
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
Smart Internet of Things Projects

You're reading from   Smart Internet of Things Projects Discover how to build your own smart Internet of Things projects and bring a new degree of interconnectivity to your world

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher Packt
ISBN-13 9781786466518
Length 258 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Agus Kurniawan Agus Kurniawan
Author Profile Icon Agus Kurniawan
Agus Kurniawan
Arrow right icon
View More author details
Toc

Table of Contents (8) Chapters Close

Preface 1. Making Your IoT Project Smart 2. Decision System for IoT Projects FREE CHAPTER 3. Building Your Own Machine Vision 4. Making Your Own Autonomous Car Robot 5. Building Voice Technology on IoT Projects 6. Building Data Science-based Cloud for IoT Projects Index

Building a car-based GPS


In the previous section, we learned how to access Google Maps API on a Python program using the Flask library. Now we can combine our previous work about reading GPS on the Pololu Zumo robot.

After the program reads the GPS data on Arduino, we can send the GPS data to our web server (Flask framework).

Firstly, we modify gpsapp.py to read the GPS data. You can read it directly from the GPS module or via the middleware app on the computer.

We will create a new routing /gps which is implemented on the get_gps_data() function. With this function, we will set the value "hardcoded". Basically, you should get lat_val and long_val from the GPS module. The get_gps_data() function returns a JSON value. This makes our program, gspapp.py, work as a RESTful server.

The following is a completed program on the gpsapp.py file:

from flask import Flask
from flask import render_template
from flask import jsonify

app = Flask(__name__)


@app.route('/hello')
defhello_world():
return 'Hello...
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 €18.99/month. Cancel anytime