@Anton85 please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```
This has nothing to do with answering your question (which, incidentally, has been answered many times before in this forum) but your void loop is a mes!
You have a timer set-up to call your sendSemsor function once per second, but read your sensor each time the void loop executes. You then prevent this from happening to frequently by adding a blocking delay in your void loop.
What you should be doing is combine your readSensor and sendSensor functions into one function and only have Blynk.run and timer.run in your void loop.
Hi Pete, I don’t think I have interpreted your advice well but I try to give you more explanations.
The attached sketch is the transmitter part. Then there is another sketch about the receiver.
In practice, the transmitter collects the data of several dht11 and dht22 sensors to load them both on the blynk and on a touchscreen receiver positioned elsewhere in the house.
I believe this is used to send the dht data to the receiver:
// Setup a function to be called every second
timer.setInterval (1000L, sendSensor);
This, on the other hand, I think is useful only to verify the reading from the terminal:
Obviously I’m a novice and for the moment I just need help taking the first steps. Thank you.
(In Italiano)
Ciao Pete, non credo di aver interpretato bene il tuo consiglio ma provo a darti piú spiegazioni.
Lo sketch allegato é la parte del trasmettitore. Poi c’è un altro sketch che riguarda il ricevitore.
In pratica, il trasmettitore raccoglie i dati di piú sensori dht11 e dht22 per caricarli sia su blynk che su un rucevitore touchscreen posizionato in un altro punto della casa.
Questo credo che serva per inviare i dati dei dht al ricevitore:
// Setup a function to be called every second
timer.setInterval(1000L, sendSensor);
Questo, invece, credo che sia utile solo a verificare la lettura da terminale:
Almost, but you need to remove this blocking delay…
which is redundant when you use the timer to control the frequency at which your `readSensorsendSensor’ function is executed.
Also, DHT11 sensors in particular (and DHT22 sensors to a slightly lesser extent) don’t like to be read too frequently.
Once every 5 seconds is probably the most frequent that you’d want to interrogate them.
Hi guys. In the end, sifting through the forum, I solved my problem. To the sketch I indicated in the first post, the following lines must be added. Obviously, if I made any mistakes in the code posted here, I hope for your help. Thank you in advance.
Ciao Ragazzi. Alla fine, spulciando nel forum, ho risolto il mio problema. Allo sketch che indicavo al primo post, bisogna aggiungere le righe seguenti. Ovviamente, se nel codice qui postato ho commesso qualche errore, spero in un vostro aiuto. Grazie anticipatamente.