Read ESP32 sensor on my Smartphone

Hello,

I would like to read a analoge sensor connected to a ESP32 on my smartphone.
I would write an anaolge output on the same ESP as well with my smartphone.
Is there anywhere an example because the examples I found closes the client (client.stop();) constantly, so there is no online update of the value's possible.
This whitin my home Wifi network.

with kind regards!

You have to use bluetooth of ESP32. You need to use the serial bluetooth terminal app. ESP32 Bluetooth Classic with Arduino IDE - Getting Started | Random Nerd Tutorials

Actually, we might get better results by leveraging the ESP32’s BLE capabilities directly. Emulating a serial port can be a bit hit-or-miss, whereas the native protocol is the standard way to handle this.

This is just one of the core-provided examples:

Exactly which ESP32 are you using as there are multiple variants with different functionality

Agreed, but it is much more complicated to setup than BTSerial

I have some reservations about this.
Using a pseudo-serial approach requires us to build a protocol that already exists elsewhere.

While it seems simple enough for one variable, I’m concerned it might add unnecessary friction once we try to scale the project.

I'd rather do it right the first time

That would be easily done with the Arduino IoT cloud.

esp32 devkitc v2 esp32 wroom 32

Both of these boards support BLE and classic bluetooth. So, you can use serial bluetooth terminal app or you can follow [cotestatnt]'s (Profile - cotestatnt - Arduino Forum) instructions. Either way you can solve your purpose.

you could run an access point and webserver on the ESP32
the ESP32 could read the senor and display the data on the web page using server-sent-events
a smartphone/laptop etc could connect to the access point SSID and run a web client to view the webpage

@stef69
You have not said whether the phone will be in BT or BLE range of the esp32.
If indeed you are within range, there are many ways you can go.

If you want an easy way to write a custom UI on an Android phone, take a look at

https://www.gui-o.com/