You did not follow @ABG's advice by implementing a clock, and you did not test whether there were in fact bytes available to receive. You cannot assume that the bytes you want to recieve are available immediately, the Arduino needs some time to send them. Therefore you need the clock to check now and then to see if there are some available. And you have to sort out for which button press the reply was if there is data available. Good luck.
Until you do that, there is not much point in trying to help you.
Hi, you shared the sample code for receiving the data via bluetooth I've a confusion my scenario is I've buttons. How should I used clock with buttons kindly guide me with it
Dear @Mahzaib_Munawar,
the annexed files are the super-simple examples of a working communication on BT between AI2 and an Arduino NANO board fitted with a HC05 or HC06 BT shield.
They work fine () on my desk. My testing device is a Lenovo 10" pad featuring Android 10 and an Arduino Nano with a HC06 shield.
I hope you will get help from them.
Obviously it is not mandatory to have an Arduino NANO, it will work with any board (UNO, MEGA,..) with serial interface capability toward an HC0x BT shield (connection schematics below).
Please be aware that on app side it could be necessary to allow the appropriate permissions (scan/connect/geolocalization) as the newer Android versions require. Related to this last matter there are already many topics with examples and solutions by @ABG, @Anke and many others.
Best wishes for your project.
It has taken me a while to understand your self imposed limitation.
To combine features of different apps, think of them as a merger of two adjoining factories, keeping the machinery and the workers, and the flow of unfinished products from work station to work station.
In this case, the workers are the Event blocks for the Clock Timer and the Button.Click events.