Hi,
This is a Ep8266 project.
The esp8266 serves a web server and wifi connection in AP Mode.
In the spiff is the webpage on a data folder.
This is how it works, once the sketch and data folder containing the webpage are up loaded to the esp8266.
On you device wifi setting search for the esp8266 wifi, join that network , use password 123456789, once connected go to a browser and type [login to view URL] and the webpage is displayed!
the esp8266 is also connected to a motor controller that uses serial to send and receive data.
Data is send or received to the controller via the webpage.
When you open the webpage it is pooling data every 2 seconds (read registers to show on the gauges) this works fine. I also have other buttons on the webpage that when pressed they tell the controller to do something (write registers to the controller).
Problem is: when page loads fresh data gets located correctly but if I press any other button data is all over the place. I'm able to test by seeing the serial traffic and what I saw is data is getting mixed up.
What I think is happening is as follows;
when page loads it request data from the controller, controller responds , esp8266 receives that data and sends it to the server every 2 seconds, but since its serial communication if I press the buttons between the process of requesting or receiving data that is supposed to read every 2 seconds it also receives that data that is from the button press. So data gets Mixed up.
So we might need to wait for full data to arrive, before going into the next task of receiving or sending data.
Please see this Video for better explanation.
[login to view URL]
I will Upload the project folder for your review
I can quickly fix your code as I am proficient in HMTL and JS hosted on ESP
your data will not be all over the place as you press buttons
i checked your code, it is not optimized enough as the code repeated writing same xHTTP functions over and over ( thus flooding up the SPIFF) instead of having only one function,
Dear sir/madam
I hope you are doing great,
My name is Amey, and I am an electronics engineer
I am doing projects on the Arduino board for the past 3-4 years, and I am capable of programming in Arduino ide
I look at your problem and found out that you have to add delay little delay to process data (10-20ms)
Than i hopw it will work just fine
message me
Thank you
Amey dahikar