I want to make a remote control app for my arduino robot which i will still build (i built the app first)
On a simple if-then version of this app which I successfully ran and connected to my Arduino I was able to open it and send the commands from my phone to the HC05 module and was printed on the serial monitor of the Arduino confirming that the app was working.
However when I made changes to the codeblocks of the app to make it more clear what it is I actually want to be sent to the Arduino when multiple buttons are pressed the app just goes to "isnt responding" immediately is there something I broke? or the app is too large for my device?
If the code inside your while loops runs more than a few seconds, then your app becomes unresponsive and will crash
Remove the while loops, use a global variable to store your latest command and use a Clock and its Timer event to send the latest comnand via Bluetooth
My exact intention is yes to keep the code in the loop running indefinitely until I release the button so the arduino will keep the motor gear of the robot to turn as it keeps on receiving which button was held until I let go of the button, but with this issue I think I will try to utilize clock as the one to keep running and sending which button is being held and minimize the Do's to setting the global variables
Thank you I just edited the code and it does work now, it no longer crashes and the up-down buttons don't disrupt the left and right ones thank you very much, and can confirm it does continuously send the desired code as the error Bluetooth not connected keeps popping up when buttons are held.
(I haven't connected to the device yet so that's why Bluetooth errors occur will try to connect it later).