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

Connecting Arduino modules to the Galileo board


In this recipe, we are going to establish a link between our Arduino Wi-Fi modules and the Galileo board. This is the first step in making the Galileo board the hub of our home automation system.

Getting ready

The first step is to have at least one Arduino Wi-Fi module ready. You also need to have the Galileo board ready to run a Node.js program with the Intel XDK software, as in previous chapters.

How to do it...

We are now going to examine the code to connect our Arduino boards to the Galileo board. We will assume here that we have two Arduino modules in our home automation system, at two different IP addresses: one ending with 103, and one ending with 105.

This is the complete code:

// Node-aREST
var rest = require("arest")(app);
rest.addDevice('http','192.168.1.103');
rest.addDevice('http','192.168.1.105');

Pretty simple, right? The only thing you need to change is the IP addresses of the boards in your system.

You also need to edit the package...