Hey Guys , please help me make a repeat button

Hey guys , i am making a robot controlled by an app created by mit app inventor.I want to make a repeat button that if pressed it should repeat whatever button i pressed before that in order with the correct timing. For example if i pressed button 1 for 2 seconds and button 2 for 5 seconds and i pressed repeat button it should repeat by automatically pressing button 1 for 2 seconds and then button 2 for 5 seconds. PLEASE HELP ME GUYS

you need to save the actions in a list:

How does a pressed button act?

Change color?

Make a noise?

It controls the actions of the robot like forward etc

Please explain the blocks to me , will it repeat any number of times I press the button in order

See my answer to a similar question here


To play back a list of events with Instants you would need to make a temporary copy of the list and deplete it using a fast repeating clock timer.

Start by doing the action at item 1.
Each clock cycle, add the timer milliseconds to item 1 's Instant. If it passes the instant at item 2, it's complete and should be removed from the list and the new item 1 's action should be performed.
(End of current cycle)

If list is empty stop.

4Please explain the blocks to me , will it repeat any number of times I press the button in order

this screen shot only stores the actions. You need to make your code according to your requirement. Please kindly explain more detail what you want to do when press repeat button.

I want to make a water spraying robot controlled by an app created by mit app inventor. It transmits signals by a Bluetooth module connected to Arduino Uno. So i will use buttons like forward, backwards, spray water etc so when I click the buttons to perform the required operations it should get stored so that whenever I feel like doing the same operations i should place the robot at the exact starting place and the repeat button should be clicked.When the button is clicked , its should perform the same button operations automatically without my intervention at the correct timing and at correct order.

You need to use the Clock component. Put your repeat code in the Timer event. In the button, add the property Clock.TimerEnabled= true if you want the code to run, or = false to stop it. On the designer's screen, in the Clock component, set the TimerEnabled property to false (uncheck the "checkbox")

Do you have the basic communication working from the buttons to the robot yet?

That comes first.

Yea I got the connection right but now I am lacking the app to control via blutooth module

The next thing you need to get working is the real time control from the app to the robot.
There are lots of examples in this board's Tutorials section.

read this tutorial of Xylophone, and you will learn: