Create "ON/OFF switch"

So I was looking at this video linked below and was wondering how the the person turned the arduino on and off with the switch, or is it just turning the backlights off? Any help on how to do this would be great.

The button in the video seems to be an ordinary (mechanical) on/off switch. What do you have in mind with your switch?

Same switch, but how do I get it to turn the arduino or LCD off?

Leo_dye:
Same switch, but how do I get it to turn the arduino or LCD off?

Can Some one help with the code.

I would like to have a Power on/off switch fro my application.

I am doing an alarm with a PIR sensor, and would like to have a mechanical on/off switch to activate/deactivate the alarm.

Thanks,

No code is needed. Just put the switch in the power supply to the Arduino.

Or connect to an input with internal pullup resistor enabled:
pinMode (onOffPin, INPUT_PULLUP);

Then read the PIR and the switch:

if ( (digitalRead(onOffPin)==0) && (digitalRead(pirPIN) == 0) ){
// do alarm code processing
}
else {
// wait for alarm to be enabled
}

Thanks for your replays.

CrossRoads approach is somehow what I am looking for.

I want to print, when the on/off switch is closed "Alarm enabled" and then run the PIR code to open/close a door. Otherwise do nothing, not even read the PIR. Also if the on/off switch is open, serial print : Alarm disabled. Just once. I could manage to turn the circuit on/off but Serial print the status a ton of times.

How do I isolate the on/off process?

Thanks again.

Post your code. Use code tags.

Sounds link you need to print "Alarm disabled" only when the switch changes state from high to low, not just keep printing all the time when it is low.