Press button :((


#1

Hi!
I will send a photo here look whats wrong please @tech_support


#2

Hi,

two issues:

  1. You use mBot program as a start block. That means you need to transfer the program to the mBot through USB cable so it runs in offline mode. If you did that by intention, all is fine. If you want the program to run in online mode, you need to use the “When green flag clicked” start block.

  2. the program runs exactly once right now. It checks if the button is pressed immediately after start, then it ends.
    I think you want the program to continously check for button press. So you need to put a “forever” loop around the if statement.
    However you will then run into the next issue: when you press the button, it will run through the loop multiple times during the time your press the button. A solution is that you wait until the button is released again at the end of the loop.

Keep trying, come back if you have more issues.


#3

To build on @Andreas’ suggestion, you will definitely need the forever loop but you might want to use the wait until block at the top of that loop with the reporter for the onboard button press to trigger the execution of your code after that.


#4