I am attaching a speed control sensor to a GPIO on ESP8266 board for measuring speed on cars passing. It works. I want to read out the speed on my IPhone. Both are connected to my local network. The IPhone shall automatically be updated with the speed of the next car, when it passes. How do I do? I have seen the videos Unit 1 and Unit 11 in module 4. They are good and Unit 11 works in practice, thanks. But I am unsure how to translate this into my target application? The main challenge is, that the cars are passing by asynchronously in time and not very often. I only want to update the IPhone screen, when a car is actually passing and I do not want to poll the ESP8266.
Conceptually, I would then think that the ESP8266 should be a client and then a webserver should be running on the IPhone. But then I think I need to have a (simple) server running on the IPhone. I have not found a good and simple concept for that. I have installed a very simple test http client on the ESP8266. It works. It is able to contact test servers on the internet, but I have not been able to establish contact to a simple 3rd party server running locally on the IPhone or a PC on the same network. And anyway, I kind of like the idea of the ESP8266 being the host (webserver) and then sending the simple HTML GUI to the IPhone like in the Unit 11 video. But again, then I do not know how to solve the automatic car initiated update, as least not in an beautiful way. Ideally, I would like the ESP8266 to stay in deep-sleep mode and then only wake up when a car comes by and generates some input on the sensor, but then I think that the ESP8266 must run as a client. And then we are back to the not so simple server issues on the IPhone. I do not want to use products like Home assistant etc.
I would like to get some hints how to move on.
Best wishes, Ole
Your issue is easy to solve.
The ESP8266 can be the web server, and a browser on your iPhone can be the client.
You just need to use server-sent events. Server-sent events are updates sent by the server to the client. The client doesn’t need to poll anything to the server. The server does that automatically. So, you can see the web interface being updated automatically.
We have this tutorial about server-sent events with the ESP8266: https://randomnerdtutorials.com/esp8266-nodemcu-web-server-sent-events-sse/
See if you can use that concept with your project. I think that is exactly what you are looking for.