Sorry I don't have example code neither, but I do have code of a project that uses a similar functionality to configure and play an 'orchestra' of esp32 'instruments', so you might find a couple of hints grepping through the code. But be warned: the code is long quite complicated, chaotic, experimental, higly configurable. I wrote (and used) that code for live performances and electronic art installations and certainly *not* as an example of good programming techniques. It might confuse you more than helping you. You *have* been warned...
A few points for better understanding: there is no master, there are no slaves, just participants.
I can take any of the instruments and give instructions to configure and play the thing or send them (using esp-now) to other instruments. Each instrument has a simple morse input (using a touch input), or the input can be given through serial input or bluetooth.
Each instrument has a name (and some other parameters) stored in nvs as an ID. I do *not* set them by the program, but on very first use with one of the above mentioned input methods using a serial menu system, that let's me change a lot of settings at run time.
All my ESP-NOW messages include a code for it's meaning. So each instrument can broadcast a message to tell all the others to broadcast their IDENTITY (including the name). Depending configuration this can be sent after booting, after finishing to play music, on request through the morse interface, etc. On receiving an ID it will be stored in the peer-list of the other instruments.
After that this peers are known to them, can be addressed individually (i.e. to start playing or configuring them). The list can be displayed including name, mac etc of all the instruments.
Most instruments have some sort of small display (like ePaper or OLED).
As you might imagine the esp-now system is deeply burried in many other code files.
Grep for 'USE_ESP_NOW' which is the main configuration switch to use it.
Compilation starts with 'pulses.ino'
Basic ESP-NOW functionality is in 'esp_now_pulses.h'
I *did* tell you it is chaotic, didn't I?
https://github.com/reppr/pulses/