Using push buttons to trigger multiple modules/outputs

I am very new to Arduino and working on a major project and have a question regarding the use of push buttons.

The project entails a time based routine and so forth. Is it possible for a push button to trigger multiple outputs (In this case I am looking to have it trigger a servo motor, led and others).

Sorry if this doesn't make sense, it has been a struggle putting it into words.

unsigned long Millis;
unsigned long pushButtonTime;
unsigned int timeToTrigger = 3000; // 3 seconds delay to trigger from button press
byte triggered;
void loop() {
  Millis = millis();
  if (digitalRead(pushButton ) == 0 && triggered == 0) {
    pushButtonTime = Millis;
    triggered = 1;
  if (triggered == 1 && Millis - pushButtonTime >= timeToTrigger) {
    digitalWrite(yourpin, HIGH);
    triggered = 0;


The word 'routine' implies multiple things happening.  Do they all happen at once and then end or is there a set sequence that's followed?

yes multiple things will be happening. They can happen simultaneously or via a sequence it does not really matter.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.