RE: Receive data via bluetooth

Hello everyone, I would like your help about the first application I made in this application.
The application is quite simple. I have a module (PCB) with 8 relays that can communicate via Bluetooth. I am trying to disconnect the relays on it. I made the application and it worked, but there is a problem. When I close the application and then open it again, I cannot see the status of the relays that I previously opened. They all appear to be closed. However, I had opened that relay the previous time. So in summary, I want the switch to take the last data sent to the relay and change its position accordingly if the relay has been opened or closed before. If the relay has been turned on before, when I open the application, I want to see it on, with the position of the button changed. How can I do it?

I apologize for my English. I'm glad I could explain it. Thank you in advance.

You could either save relay statuses in TinyDB or ask the relays for their status at startup.

Thank you very much for your answer and help Mr. ABG. How can I implement these suggestions? Each relay has a hex code that I use to turn it on (For example, if I send A1 as Hex, the relay pulls 1, the same situation continues for other relays as B1). Will I be informed about their status by using those codes? Or do they have other addresses? I would like some more help from you on how to do it. The arguments and documents I can use will also be helpful. I share my code with you below.

`


resim_2023-10-23_203100311

You have not posted your sketch.

Knowing how the codes work would help design TinyDB keys and values.