O'Reilly logo

Internet of Things Programming with JavaScript by Ruben Oliva Ramos

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

Monitoring temperature, humidity, and light using Node.js with Arduino Wi-Fi

In this part of the chapter, we will explain the code for the Wi-Fi shield with Arduino:

Monitoring temperature, humidity, and light using Node.js with Arduino Wi-Fi

We define the number of variables; in this case we will monitor three variables (temperature, humidity, and light):

#define NUMBER_VARIABLES 3 

Here we have to include the library for the sensor:

#include "DHT.h" 

We define the pin for the sensor:

#define DHTPIN 7  
#define DHTTYPE DHT11 

We define the instance of the sensor:

DHT dht(DHTPIN, DHTTYPE); 

We import the libraries for the module:

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

We define the ...

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