I worked on a project where I use a DHT22 sensor to read humidity and temperature in my room. I adapted some code I found on the Internet, because I'm new to ESP8266.
I use 2 ESP8266 (NodeMCU 1.0 ESP12-E) boards. The first board (server) is connected to the DHT22 Sensor and it reads temperature & humidity in my room once every 5 minutes, sends the data to the other board (client) and then goes into deepsleep, then after 5 minutes it wakes up, makes another reading and the cycle goes on. The other board (client) listens to the server and its just sending data to Thingspeak (for now).
All works fine, I can monitor the data, see the charts online or on the mobile App. The problem I face is that I want to change the code in order to be able to control my heating system through a relay. This means that I want to set up a temperature through a HTML webpage, for example I want to type it into a Form and Submit it through a Button (of course the HTML code should be on the second ESP which is always on). I made an if statement so it compares my room temperature and if it is higher than the temperature I set, the relay goes OFF and the heating system stops, else the heating system is ON until I reach the temperature I set. I declared the variables I need for this (temp, settemp and relay), but for now I can only SET the temperature inside Arduino IDE environment, I don't know exactly how to do it through a website...
I need some help with creating the HTML Website and the Form (a simple textform & a button), to be able to update my settemp variable. I tried to adapt some code but I got some weird errors. Is it possible to actually modify my ClientCode so it's able to create a WebSite and update the temperature everytime I press the Submit button and also send the data to Thingspeak? Or i need to remake everything because the client-code is not made for this?
Thanks in advance. Any Help is appreciated ! (the Code is in the attachments)