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 now! 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
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Arduino Networking

You're reading from   Arduino Networking Connect your projects to the Web using the Arduino Ethernet library

Arrow left icon
Product type Paperback
Published in Aug 2014
Publisher
ISBN-13 9781783986866
Length 118 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Marco Schwartz Marco Schwartz
Author Profile Icon Marco Schwartz
Marco Schwartz
Arrow right icon
View More author details
Toc

Plotting the data locally

To end the chapter, we are going to see how to plot data measured by the Arduino board. To do so, we will modify the Arduino sketch a little bit, and then use part of the code from the previous chapter to plot the data right in your web browser.

First, we are going to modify the Arduino sketch so that it returns data in a more useful format; in the present case, the JSON format. In place of the code responsible to print out the measurements, we are going to simply print the data in the JSON format. This is done using the following piece of code:

client.println("HTTP/1.1 200 OK");
client.println("Content-Type: application/json");
client.println("Connection: close");
client.println();
client.print("{\"temperature\": ");
client.print(temp);
client.print(", \"humidity\": ");
client.print(hum);
client.println("}");

We can now quickly test this project. Upload the code to the Arduino board again...

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