Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "DHT.h"
- #define DHTPIN 13 //D7 pin on NodeMCU
- #define DHTTYPE DHT11
- DHT dht(DHTPIN, DHTTYPE);
- #include "UbidotsMicroESP8266.h"
- #define TOKEN "BBFF-Y9WIaWHXgrw2bWbByx4eao0DDtCwy5" // Put here your Ubidots TOKEN
- #define WIFISSID "Hare Krishna"
- #define PASSWORD "12345678"
- Ubidots client(TOKEN);
- unsigned long lastMillis = 0;
- void setup(){
- Serial.begin(115200);
- dht.begin();
- delay(10);
- client.wifiConnection(WIFISSID, PASSWORD);
- }
- void loop(){
- if (millis() - lastMillis > 10000) { ///every 10S
- float MyHumidity = dht.readHumidity();
- float MyTemperature = dht.readTemperature();
- lastMillis = millis();
- client.add("MyHumidity",MyHumidity );
- client.add("MyTemperature",MyTemperature );
- client.sendAll(true);
- }
- }
Add Comment
Please, Sign In to add comment