Hi
I am looking for example code for playing tone on iPhone using esp32 WiFi
Read about MIT app inventor to control hardware with a smartphone.
Can you add some color/ context to your request?
It is not possible to play a tone directly on an iPhone using only an ESP32 over Wi-Fi without an app. iOS does not allow a background network device to trigger audio playback on the iPhone unless the action is initiated by the user through a physical interaction or handled by an app installed on the device.
Also you can’t use an iPhone as a Bluetooth speaker. An iPhone can only send audio to other Bluetooth devices, but it can’t receive and play audio from another device.
What is possible is serving a web page from the ESP32 that the user opens in Safari. This page can include a button which, when tapped, plays a sound using JavaScript or write an app that receives audio over Wi-Fi (for example, using AirPlay or a custom UDP/TCP stream) and plays it out.
➜ The key point is that user interaction is required.
Maybe a Wi-Fi buzzer or a thermometer with an audible alarm that will notify you of a high temperature?
Draw a picture of your idea... you do not need to be an artist, just try to "explain" the location of devices and how devices communicate.
The ESP32 LEDC peripheral is a type of PWM on a hardware pin. How do you envision transferring that to the iPhone via WiFi?
https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/peripherals/ledc.html
The doc states
The default SSID is WiCardMp and the default password is 12345678. Connect and go to 192.168.4.1/config with a web browser.
So open region settings on your iPhone, change the WiFi to be WiCardMp, type in the password 12345678 to join. The. Launch Safari et go to 192.168.4.1/config
(I did not try nor read their code. Seems poor idea to not use a captive portal to facilitate joining this gig).
Side note:
please, please never ever again post pictures of text... Not only they are not readable nor usable directly for copy&paste but they use up lots of storage and internet bandwidth which contributes to polluting the planet.
➜ do your part and do yourself a favour and please read How to get the best out of this forum and post accordingly.

