3 buttons in order to trigger event

Hi,

I am trying to setup a touch-pad with 3 buttons. The idea is that all 3 buttons need to be pressed at the same time in order for the touch-pad to be active.

Button 1 = pressed

Button 2 = pressed

Button 3 = pressed

gives power to touch-Pad sensor

Touch pad pressed = Unlock door

The buttons do not need to be pushed in any specific order. The idea is that the touch pad will only work once all 3 buttons are engaged.

Any help is greatly appreciated.

void loop()
{
   button1 = digitalRead(pin1);
   button2 = ...
   button3 = ...

   if (button1 && button2 && button3) {
   //all 3 button pressed same time
  //do something here
   }

}

Be more proactive in your design, use the internal pullup resistors you know the pins are not 'floating'.

byte pin1 = 2;
byte pin2 = 3;
byte pin3 = 4;
void setup(){
pinMode (pin1, INPUT_PULLUP); // turn on internal pullup resistor wire button between pin & Gnd
pinMode (pin2, INPUT_PULLUP);
pinMode (pin3, INPUT_PULLUP);
void loop()
{
   button1 = digitalRead(pin1);
   button2 = digitalRead(pin2);
   button3 = digitalRead(pin3);

   if ((button1 ==LOW) && (button2==LOW) && (button3==LOW)) {
   //all 3 button pressed same time
  //do something here
   }

}