Multiple wait commands in one project

Dear community,

I'm having trouble realizing a project that ideally contains multiple wait commands with varying delay times.

I was able to implement a wait command according to Scott's "Please Wait" solution mentioned various times by Taifun, but when it comes to multiple different waiting times at some point it's not feasible anymore as you have to add a new timer component for each value.

In my case I need the app to play an audio file while simultaneously sending out bluetooth commands, wait for xy amount of milliseconds, send another command, wait for yz amount of milliseconds and so on and so forth... about 200 times.

Now I know that app inventor may not the perfect environment for realizing something like that but is there maybe a completely different solution to this problem?

Many thanks!
Julian

You can do that with a single Clock Timer (wait seconds) , using a single global variable, the value of which is changed each time before being sent.

Do you have a List of Commands to send in sequence that you can post here as an example? Can the Clock Timer interval always be the same or does it need to vary?

(I'm away from my desk now, back later this evening UK time)

You need one Clock following a schedule of deadlines and actions.

Here are some examples ...

1 Like

Hi Julian

This is basically how it can be done with a single Timer:

BT_Send_Commands.aia (9.5 KB)

To read the Blocks image, you will have to download it!

Hi everyone,

many thanks to @ABG and @ChrisWard for your quick response. I had a look at both solutions and decided to go with @ChrisWard using a list and progressive indices within an if loop. I slightly adapted (mainly simplified) it to suite my scenario. Thank you very much!

MULTIPLE_WAIT_TEST_150822.aia (83.8 KB)

Julian

1 Like

For future reference, your technique to select the command text from the current pair (command, time) is risky.

Instead of forcing a text conversion and using segment(), you could have just selected item 1 from the pair, like you selected item 2 from the next pair.

1 Like

@ABG that's a very good point. I was afraid this could cause any errors so I already replaced the "segment text" command like you said. Seems to be the more elegant version!