Question about stopping a loop and to make a loop inside a code.

I'm making a code so I can drive my little car via Bluetooth. I want 1 button to activate a loop and the other button to stop that loop(I'm talking about blinking lights or a little song with a zoomer). I tried to do so via a simple loop but I have to fill the "Times" in, this way I can't stop the loop while the amount isn't done yet...

Sorry if my sentences aren't that great :slight_smile: I'm from Belgium so :wink:

Hopefully someone can help me

We can't see your code.
We can't see your schematic

@itzme

Your topic was Moved to it's current location / section as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

itzme:
I want 1 button to activate a loop and the other button to stop that loop

That's probably not a good way to approach the problem.

Have a look at how the code is organized in Several Things at a Time

Note how each function runs very briefly and returns to loop() so the next one can be called. None of the functions tries to complete a task in one call. And there may be dozens of calls to a function before it is actually time for it to do anything.

Use the buttons to change the value of a variable.

Use the value of the variable to determine which parts of the program are active.

...R