I'm new in the community and I am just approaching the IoT world, and I'm doing it with Blynk.
I need to display the values of a temperature sensor DHT11 and command at the same time a relay. I used a Wemos D1 R2, a DHT11 (with a 4.7k resistor between pin 1 and pin 2) and small relay. I created my first sketch, taking various bits here and there, and it came out the following:
define BLYNK_PRINT Serial
define DHT11_PIN 14
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth = "c522c8390f064cc897a430424b822bd8"; //insert here your token generated by Blynk
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid = "Vodafone-33990400";
char pass = "tjm4bkdds3vdvx5";
Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth, ssid, pass);
// Setup a function to be called every second
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(10, DHT.temperature); //virtual pin
Blynk.virtualWrite(11, DHT.humidity); // virtual pin
Blynk.run(); // Initiates Blynk
timer.run(); // Initiates SimpleTimer
chk = DHT.read(DHT11_PIN); // READ DATA
Serial.print("Umidita' (%): ");
Serial.print("Temperatura (C): ");
The problem is that the values of DHT11 are displayed, for some short time properly, then stabilize to 11 ° C and 145 to the humidity. Occasionally I show again the values it gives me to a place still reading instability.
How can I do?