Book Image

Internet of Things with the Arduino Yún

By : Marco Schwartz
Book Image

Internet of Things with the Arduino Yún

By: Marco Schwartz

Overview of this book

<p>Internet of Things (IoT) is currently a growing trend in the technology space, and the Arduino Yún is the perfect board to get started with building IoT projects. This book covers many of the powerful features of the Arduino Yún via four exciting projects. The first project is all about sending weather measurements data to a Google Docs spreadsheet for easy online visualization. The second one is about building an energy consumption meter and controlling devices remotely. The third focuses on the field of security, by helping you to build a camera that is triggered by motion and that uploads pictures automatically to Dropbox. Finally, the last project is in relation with the field of robotics, and focuses on building a robot that is controlled via Wi-Fi. <br /><br />The main focus of this book is to teach everything you need to know to build complex projects using the Arduino Yún, organized around the fields of home automation, security, and robotics.</p>
Table of Contents (11 chapters)

Building the computer interface


We are now going to build an interface so you can control the robot remotely from your computer or a mobile device. This is actually quite similar to what we did for the relay control project, the main difference being that we also want to read some data back from the robot (in the present case the distance measurement from the ultrasonic sensor). There will be an HTML file that will host the different elements of the interface, some PHP code to communicate with the Yún board, some JavaScript to establish the link between HTML and PHP, and finally some CSS to give some style to the interface.

The first step is to create the HTML file that will be our access point to the robot control. This file basically hosts four buttons that we will use to control our robot and a field to continuously display the distance measured by the ultrasonic sensor. The buttons are declared inside a form; the following is the code for one button:

<input type="button" id="stop" class...