Commit f4e1cc0a authored by chethan sai's avatar chethan sai

updated thingsboard code

parent eab8d627
#include "DHT.h"
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
#include "MQ135.h"
#define WIFI_AP "FreedomBox"
#define WIFI_PASSWORD "swecha12345"
#define ANALOGPIN A0
#define WIFI_AP "Oneplus 6T"
#define WIFI_PASSWORD "12345678"
//#define TOKEN "zpzUwwM9okKwEC9B1gFq"
#define TOKEN "hS3ZChuxJz6iwKAuC6NH" //Vijayawada
......@@ -55,12 +57,16 @@ void getAndSendTemperatureAndHumidityData()
Serial.println("Collecting data.");
float h = dht.readHumidity();
float t = dht.readTemperature();
//float rzero = gasSensor.getRZero();
//float ppm = gasSensor.getPPM();
float mq135 = analogRead(ANALOGPIN);
//float latitude = 16.4799, longitude = 80.6174; //Tadepalli
//float latitude = 16.5062, longitude = 80.6480; //Vijayawada
float latitude = 16.4473, longitude = 80.6049; //Vaddeswaram
String temperature = String(t);
String humidity = String(h);
String mq = String(mq135);
String lat = String(latitude);
String lon = String(longitude);
......@@ -69,7 +75,8 @@ void getAndSendTemperatureAndHumidityData()
payload += "\"lat\":"; payload += lat; payload += ",";
payload += "\"lon\":"; payload += lon; payload += ",";
payload += "\"temperature\":"; payload += temperature; payload += ",";
payload += "\"humidity\":"; payload += humidity;
payload += "\"humidity\":"; payload += humidity; payload += ",";
payload += "\"mq135\":"; payload += mq;
payload += "}";
// Send payload
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment