Infrared sensor (Different approach)

Hi i am Jovian, just started using arduino. Was wondering if i am able to write a programming or make a setup where i can use a push button to control my infrared sensor. Example, my push button will be like my main on/off switch which can stop and allow my infrared sensor to work. (Like charging a phone, i plug in my adapter into the socket to charge my phone i on the switch when i want to charge and when i am done charging i off the switch, my phone will be my infrared sensor)

The code i am currently using, my infrared sensor will trigger the buzzer. (what i need help is, adding another push button to act as a main switch to power everything.) Thanks!

//IFR to Buzzer by Jovian const int IFR = 3; // INFRA-RED SENSOR int BUZZER = 13;

void setup()

{ Serial.begin(57600); pinMode(BUZZER,OUTPUT); pinMode(IFR,INPUT); digitalWrite(BUZZER,LOW); }

void loop() { if(digitalRead(IFR)==LOW) { digitalWrite(BUZZER,HIGH); delay(3000); digitalWrite(BUZZER,LOW); } else digitalWrite(BUZZER,LOW); Serial.print("IFR DATA:"); Serial.println(digitalRead(IFR),BIN); delay(50); }