Search icon
Subscription
0
Cart icon
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
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

Table of Contents (14) Chapters

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

Sending power consumption data to Xively


Let's now build the sketch that will upload the power measurement data to Xively. The sketch is based on a test sketch, so I will only detail the new parts. We will now go through the most important parts of the code for this section. To get the complete code, please refer to the GitHub repository of this chapter.

It starts by importing the correct libraries:

#include <Adafruit_CC3000.h>
#include <SPI.h>

We then need to define the pins of the CC3000 chip:

#define ADAFRUIT_CC3000_IRQ   3
#define ADAFRUIT_CC3000_VBAT  5
#define ADAFRUIT_CC3000_CS    10

After that, we need to declare the CC3000 instance:

Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT, SPI_CLOCK_DIV2);

Now, this is the part where you need to enter your information. First, you enter the SSID and the password of your local Wi-Fi network:

#define WLAN_SSID       "yourSSID"
#define WLAN_PASS       "yourPassword"
#define WLAN_SECURITY...
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}