I want to maintain water temperature using an ESP8266 (Arduino-like)
I have a temperature sensor (ds1820) working, which measures the current temperature and a relay to switch a heater on and off.
I use one trigger to switch the heater on when the water temp falls below TARGET TEMP and another trigger to switch the heater off once the temperature rises above TARGET TEMP +1 degree celsius.
My issue is; how to have a widget on my dashboard where I can set the TARGET TEMP and then pass that value to the triggers.
So far I’ve read to use a custom slider widget, set to PWM, on a virtual pin. The code behind this widget reads the slider value and stores it in a variable.
The widget created this code:
#define PWM_VIRTUAL_PIN 1
#define PWM_DIGITAL_PIN 3 (don’t think I need this?)
int currentValue = getValue.asInt(); // 0 to 1023
analogWrite(PWM_DIGITAL_PIN, currentValue / 4); // must be from 0 to 255 (what does this part do??)
But as a newbie, I don’t know what next!
How do I pass the value in that variable to the triggers?
Please write slowly as I cannot read fast.