Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Hands-On Robotics with JavaScript

You're reading from   Hands-On Robotics with JavaScript Build robotic projects using Johnny-Five and control hardware with JavaScript and Raspberry Pi

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781789342055
Length 214 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Kassandra Perch Kassandra Perch
Author Profile Icon Kassandra Perch
Kassandra Perch
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Setting Up Your Development Environment FREE CHAPTER 2. Creating Your First Johnny-Five Project 3. Building Interactive Projects with RGB LED 4. Bringing in Input with Buttons 5. Using a Light Sensor to Create a Night-Light 6. Using Motors to Move Your Project 7. Using Servos for Measured Movement 8. The Animation Library 9. Getting the Information You Need 10. Using MQTT to Talk to Things on the Internet 11. Building a NodeBots Swarm 12. Assessments 13. Other Books You May Enjoy

Getting weather data on our Pi with OpenWeatherMap


We're going to build a weather bot for this one, and while we could use a temperature sensor, that'd only tell us what it's like indoors, and usually we'd like to see what the weather's like outside before we head out the door. So we're going to use the OpenWeatherMap API to get data and display it on a character LCD; but let's walk before we can run by starting with getting the data from the API to the Pi.

Getting an OpenWeatherMap API key

First, you'll need to sign up for an account at https://openweathermap.org/, and generate an API key. Then, click your username in the upper-left corner and select API Keysfrom the tabs that appear near the top of the page:

Generate an API key on this page and keep the tab open; we'll use it in the next section to get the info we need.

Next, open the API link in a separate tab; you'll see the main API function calls on this page. The one we're looking for is right at the top – current weather data.

 

Click...

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