Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Arduino Home Automation Projects

You're reading from  Arduino Home Automation Projects

Product type Book
Published in Jul 2014
Publisher
ISBN-13 9781783986064
Pages 132 pages
Edition 1st Edition
Languages
Author (1):
Marco Schwartz Marco Schwartz
Profile icon Marco Schwartz
Toc

Table of Contents (14) Chapters close

Arduino Home Automation Projects
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Building Wireless XBee Motion Detectors 2. Control Lights from Your Phone or Tablet 3. Measuring the Temperature Using Bluetooth 4. Weather Station in the Cloud with Xively 5. Monitor Your Energy Consumption in the Cloud 6. Hack a Commercial Home Automation Device 7. Build Your Own Home Automation System Index

Building a graphical interface


However, it's not convenient to control the hacked device from the serial monitor. We are now going to build a simple interface to control this device. The interface will be really basic and include two buttons: one to set the relay on and the other to set the relay off.

The interface is based on HTML for the interface itself, JavaScript to handle the commands, and PHP to interface with the Arduino board. This interface is very similar to the one we developed in Chapter 2, Control Lights from Your Phone or Tablet.

The following code will be a walkthrough of the different pieces of the interface. All the files have to be located inside the same folder at the root of your web server folder. You can find the complete code for this part inside the GitHub repository of the book.

Let's first see the HTML file that contains the interface itself. Inside the HTML file, the following is the code for a button:

<button class="btn btn-block btn-lg btn-primary" type="button...
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 $15.99/month. Cancel anytime}