O'Reilly logo

Arduino Networking by Marco Schwartz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Controlling the relay remotely

Now, we are going to build our first interesting application using the system we just assembled. We are going to build an Arduino sketch to control the relay from anywhere within your local network. For example, if your computer is connected via Wi-Fi to your router and the Ethernet shield is connected to the same router, you will be able to control the relay via your computer. The advantage of this approach in this section is that even if your Internet connection is down, you will still be able to control the relay.

The application starts by including the correct libraries:

#include <SPI.h>
#include <Ethernet.h>
#include <aREST.h>

We set up the MAC address of the board:

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xFE, 0x40 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required