Hi
This is a dual purpose project. Temperature and humidity is measured using DHT11 and monitored in the dashboard. In addition, there is an LED (which can be a relay or light etc. for custom applications) that can be controlled through the dashboard. The project uses Nodemcu programmed by arduino ide.
with This plan we can control the things around us while the local sensors information is at our disposal.
#include <SPI.h>
#include <ESP8266WiFi.h> //ESP8266 WiFi connection library
#include <ThingerESP8266.h> //THINGER.IO library
#include "DHT.h"
#define DHTPIN D7
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
// Thinger.io connection parameters
#define user "******"
#define device_Id "******"
#define device_credentials "******"
ThingerESP8266 thing(user, device_Id, device_credentials);
void setup() {
pinMode(5,OUTPUT);
// Setup WiFi
thing.add_wifi("****", "****");
// Define the 'thing' with a name and data direction
thing["LED"] << [](pson& in){
if(in.is_empty()){
in = (bool) digitalRead(5);
}
else{
digitalWrite(5, in ? HIGH : LOW);
}
};
thing["dht11"] >> [](pson& out){
// Add the values and the corresponding code
out["humidity"] = dht.readHumidity();
out["celsius"] = dht.readTemperature();
};
}
void loop() {
thing.handle();
}