Hello,
I've created an application with which I can control a robot in arduino with a Bluetooth module. I installed the application on my smartphone but after a few commands, the application is crashing, after that I receive the message "Application stopped working" and Close app or wait.
There are some screenshots.
Yes, I can see them in serial monitor, is like they appear a lot of times per seconds, but just the commands when the button is TouchUp. The commands from TouchDown appear only when I press the button, like one time if I just click it
I haven't used the Bluetooth stuff before but if I was to guess at the problem I would say your overloading the apps buffer causing it to crash.
you can test this by creating a variable and check it when you send a command so that it is only sent a few times (just in case some are not read). Try that and see if the app still crashes.
Again I might be completely wrong, its just my best guess.
Ok next idea. Once you check that bluetooth is connected and it is connected put the block Clock1.TimerEnabled to false in there and see if that works.
Actually there are a number of errors in your blocks that luckily do not cause a crash but I think the issue with touch up/ touch down is that often they are not sensed as a single touch. 'Clicked' is much more reliable - you can use a Boolean variable to determine which command to send.
In future: Right-mouse in the Blocks work area and select "Download Blocks as image" so that we can read them easily.
Joel is right to suspect that Clock1's constant calling could interrupt your command sending. It is just not the best way to code - you should perform the check just before the command is sent, therefore in the button event, no clock required.
Your crash could also be caused by something in the Arduino Sketch. Upload it to this Topic (by changing it's file extension to .txt ) for someone to study for you.
I've tried what you said, thank you, but still, the application is crashing and after that appear the message with "close app", even if I have the Screen error block, there are no message sent and the app go down.
I use just one screen, I'll put here the code in arduino and a new image of blocks.