Book Image

Intel Galileo Networking Cookbook

By : Marco Schwartz
Book Image

Intel Galileo Networking Cookbook

By: Marco Schwartz

Overview of this book

Table of Contents (15 chapters)
Intel Galileo Networking Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Live data visualization


In the last recipe of the chapter, we are going to improve the previous recipe by adding a refresh feature to the project, so that the graph is refreshed as new data comes in. This will avoid having to constantly refresh the page.

Getting ready

Make sure that you have carried out and tested the previous recipe, as we are going to improve it. Of course, as usual, you will find the whole code inside the GitHub repository of the book.

How to do it...

Here, we are going to improve the code from the previous recipe in order to measure data and display it on the graph.

First, we need to add some code to the app.js file in order to make measurements and write them into the database.

This is done with the following piece of code:

app.get('/make_measurement', function (req, res) {

    // Prepare request to Galileo server
    request_options = {
        url: 'http://192.168.1.103:3000/api/analog/read?pin=0',
        json: true
    }

    // Make request to Galileo server
    request...