The app died when pressed some buttons need help please

Hi,
The button 'a' and 'b' send to Arduino Bluetooth, and require some data return, but the app died after the button pressed, why?

btn.3

'-1' in block button 'a' and 'b' , I learned on line, is that right?

Thanks
Adam

btn.1


JMMAGCOR_V5_ls.aia (9.2 KB)

The word block can mean two different things:

  • those colored rectangles used in the Blocks Editor, or
  • to cause the app to stop dead until a certain thing happens.

Unfortunately for your app, you are experiencing the second circumstance in your buttons a and b.

This is caused by attempting a BlueTooth Receivetext(-1) unshielded by a test for BytesAvailable>0.

Do your ReceiveText ONLY in the Clock Timer, and do not use a WHILE loop there. The Timer repeats for you., right?

If you need to do something special with the response from BlueTooth depending on which button was just pressed, keep a global variable called whatButtonWasJustPressed initially blank, and set it to 'a' or 'b' in the matching button's Click event. Test that global variable after you receive data,and reset it to blank if you got data and handled it.

2 Likes

Suggested corrections (draggable):

2 Likes

Great!
Thank you ABG, have very good night.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.