Normally, I’d suggest that you start by reading this:
However, your code is such a mess that you should probably start by looking at one of the thermostat examples that are on this forum and get that running with your hardware, then modify it to do exactly what you want.
That looks much better, but what is the purpose of this line in the BLYNK_WRITE(V5) callback?
You obviously don’t have any code to read the actual temperature from your sensor yet. I assume that this will go at the beginning of your sendUpTEMPERATURE function?
Personally, I’d change the timer on this to at least 5 seconds.
I’m sorry, but I don’t understand what you’re saying here.
Is the code that you posted above the code that is giving the results in the app screenshot? The screenshot appears to show an LCD widget that isn’t in your code, plus a button that isn’t in the code either.
I will set the desired temperature with SET_TEMP (V5), with the help of slider.
TEMPERATURE is my home actuel room temperature from LM35.
EXTERNAL_RELAY is my boiler contactor.
LED is my EXTERNAL_RELAY 's active / pasive status.
LCD widget is only visual of SET_TEMP and ROOM TEMPERATURE.
which button isnt in my code?
Okay, it seems that as well as using a virtual pin for your slider widget, you are using direct pin manipulation (digital pins) for your buttons. Personally, I NEVER use digital (or analogue for that matter) pins in my app - it severely limits what you are able to do in terms do control, and, from what others say, can lead to some unreliability.
Are you using Eventor to handle your LCD display? I can’t see how this is displaying the data otherwise.
And, I still can’t see how your temperature readings are making their way into the sketch.
What happens if you unplug the Ethernet cable from your Arduino? Does the Arduino still control your relay when the temperature is above or below the target?
If not, is it important to you that the relay is controlled correctly when the internet or the Blynk cloud server is down?
INCOMING_DATA = analogRead(LM35);
VOLTAGE = (INCOMING_DATA / 1023.0) * 5000;
TEMPERATURE = VOLTAGE / 10.0;
i am sorry, i missed it. because i cant try my last program…
and now, no network in my arduino, but my relay is HIGH… Is my program wrong? or no network connection??
what can i do for my relay be OFF, when my network has broken??
The disconnections are most likely caused by your own network settings, or by the board itself. You can check the DHCP lease time setting in the router to see if that corresponds with the disconnection frequency. If it does then moving to a static IP or your device may help.
If your device isn’t reconnecting automatically then look at adding a routine to check for this and attempt to do a reconnection. There are plenty of examples for WiFi boards on the forum, but probably fewer for Ethernet.
But, in my experience over a 6-month period, these Ethernet shields are notoriously unreliable and will eventually get to a point where a physical reset (via the reset button or pulling the reset pin low) is the only option, and even then multiple attempts are often required. This is the reason why I swapped to NodeMCU devices.