Introduction: Use a Button to Execute Commands on a Raspberry Pi
I am sharing the project i did for the 2016 fll competition with the hackground team where i made a mouse trap that detected when a mouse entered and sent you an email.
Step 1: Lets Go!
the first thing you need to do is download andrewH7's python code which will be perfect for what we are doing
once you download this to your raspberry pi you must edit the code so it works
and once you do that you can change os.system("sudo shutdown -h now")
to any command you want within the parenthesis
now you are finished all you need to do now is run the script and connect pin 21 on the gpio to ground