Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Intel Edison Projects

You're reading from  Intel Edison Projects

Product type Book
Published in May 2017
Publisher Packt
ISBN-13 9781787288409
Pages 264 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Avirup Basu Avirup Basu
Profile icon Avirup Basu

Table of Contents (7) Chapters

Preface Setting up Intel Edison Weather Station (IoT) Intel Edison and IoT (Home Automation) Intel Edison and Security System Autonomous Robotics with Intel Edison Manual Robotics with Intel Edison

Getting data to Edison by using MQTT

We have been talking about home automation controlling electrical loads, but everything has a starting point. The most basic kick-starter is controlling Edison over the Internet—that's what it's all about.

When you have a device that is controllable over the Internet, we recommend controlling the electrical loads. In this other mini-project, we are going to control a simple LED that is already attached to pin 13 of Intel Edison. There is no need for any external hardware for this, as we are using an in-built functionality. Now, open your editor and type in the following code:

var mraa = require('mraa'); var mqtt = require('mqtt');

varledPin=new mraa.Gpio(13); ledPin.dir(mraa.DIR_OUT);

var client = mqtt.connect('mqtt://iot.eclipse.org'); client.subscribe('avirup/control/#') client.handleMessage=function(packet,callback)

{

...
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}