Wait for Bluetooth Response?

Building a robot that when you send a serial command (a single digit) it stores that command into an array and then sends a response back so you are aware you can send another command (digit).

If you use a simple serial bluetooth controller app, you can see it printed out so you know when you can send the next command but is there a way in MAI to wait for the response?

Give you an idea, there will be a serious of buttons (each equating to a digit to send) and I would like to deactivate the buttons until there is a response, thus unlocking the buttons and allowing for the next command to send.

Cheers!

There is no waiting needed here.

Just keep a global list of your button components, and code two procedures,

  • enable_all and
  • disable_all to loop through the list and for each button in the list, set its .Enabled attribute to true or false, depending on which procedure you call.

Call procedure enable_all whenever

  • you start the app, and
  • whenever your Clock Timer receives a response

Call procedure disable_all whenever

  • you send a command

Look in the Any Buttons section of the Blocks Editor pallette for the blocks to set Any Button's .Enabled attribute.

Can you expand on "when clock timer receives a response" bcz maybe that is my issue of focus.

I know how to enable and disable buttons but I want to disable the buttons after the button is pressed and sends a command THEN only re-enable the buttons AFTER the app received a response back from the Arduino.

Is this Clock Timer relative to bluetooth serial communications?

This should get me in the right direction. Thanks!