// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud // See the Device Info tab, or Template settings #define BLYNK_TEMPLATE_ID "********" #define BLYNK_DEVICE_NAME "********" #define BLYNK_AUTH_TOKEN "********" // Comment this out to disable prints and save space #define BLYNK_PRINT Serial #define DHTPIN 13 #define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 #include #include #include #include "DHT.h" #include char auth[] = BLYNK_AUTH_TOKEN; // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "********" char pass[] = "********" float temperatura = 0; float umidita = 0; DHT dht(DHTPIN, DHTTYPE); void setup() { // Debug console Serial.begin(115200); Blynk.begin(auth, ssid, pass); // You can also specify server: //Blynk.begin(auth, ssid, pass, "blynk.cloud", 80); //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080); /* // Clear the terminal content terminal.clear(); // This will print Blynk Software version to the Terminal Widget when // your hardware gets connected to Blynk Server terminal.println(F("Blynk v" BLYNK_VERSION ": Device started")); terminal.println(F("-------------")); terminal.println(F("Type 'Marco' and get a reply, or type")); terminal.println(F("anything else and get it printed back.")); terminal.flush(); */ dht.begin(); } void loop() { Blynk.run(); temperatura = dht.readTemperature(); Serial.print("temperatura: "); Serial.println(temperatura); umidita = dht.readHumidity(); Serial.print("umidita: "); Serial.println(umidita); Blynk.virtualWrite(V4, temperatura); // Set Virtual Pin 0 frequency to PUSH in Blynk app Blynk.virtualWrite(V5, umidita); // Set Virtual Pin 1 frequency to PUSH in Blynk app delay(5000); }