Make sketch wait for button

alex117j:
would i use boolean conditions to change states for example
if (MOTION_PIN == HIGH && digitalRead(BUTTON_PIN) == LOW)
{
// systemstate = a
}

Nearly but not quite.

Don't do two "external" tests at the same time. The logic should be something like

void loop() {
   motionPinState = digitalRead(MOTION_PIN);
   buttonPinState = digitalRead(BUTTON_PIN);
   if (systemState == 'w' && motionPinState == HIGH) {
      systemState = 'm';
   }
   if (systemState == 'm' && buttonPinState == HIGH) {
      systemState = 'b');
   }
   if (systemState == 'b') {
      // do your stuff
      systemState = 'w'';
   }
}

...R