several things at the same time Question

hello
i am just playing around with the code trying to start the 'several things at the same time 'with a push of a button. Is this possible?and at what part of the Code should i be inserting the push button function.

The code would be a state machine, and the initial state would be "waiting for a button press"

If you use the delay() function in your code the processing of your sketch will stop for the time period you specify.

No doubt you will want to monitor and time the various functions that you start with the button so you will probably find it useful to read the tutorial to see how you can time things without stopping.

Redloup:
i am just playing around with the code trying to start the 'several things at the same time 'with a push of a button. Is this possible?and at what part of the Code should i be inserting the push button function.

Are you referring to the code in my Several Things at a Time ?

I can't say I understand what you want when you say "start ... with a push button"

Please describe what you want the program to do (or not to do) that is different and what should happen when you press the button.

...R

hello
I do not really want to change the code , just add to it try learn

the first thing i am trying to achieve is - i am trying to add a push button to initiate the sequence to start.
because at the moment i just load the code to the arduino and it all just happens

the second thing i would like to do is the same as above but after say 10 minutes the sequence times out and stops till you press the button again.

Sorry if my wording is wrong and it makes it hard to understand.

Have a look at the examples involving digital
Inputs .

The “while” function is worth a look - with this you could hold the program up , in setup, until your button is pressed.

Redloup:
the first thing i am trying to achieve is - i am trying to add a push button to initiate the sequence to start.
because at the moment i just load the code to the arduino and it all just happens

If you literally want the whole thing to wait until you press a button you can add this code at the start of setup().

void setup() {
  pinMode(pushButtonPin, INPUT_PULLUP);
  while (digitalRead(pushButtonPin) == HIGH) {
  }

  // the rest of the code in setup

...R

Wow just like that you make it seem so easy. Thanks

Redloup:
after say 10 minutes the sequence times out and stops till you press the button again.

Because of that, you don't really want to put the "wait for button press" code in setup(). If you do, you will have to repeat the same code somewhere in loop(). A good programmer always tries to avoid having code repeated.