Introduction: Use a Button to Execute Commands on a Raspberry Pi

Picture of 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!

Picture of Lets Go!

the first thing you need to do is download andrewH7's python code which will be perfect for what we are doing

link to andrewH7's instructable

once you download this to your raspberry pi you must edit the code so it works

Change gpio_pin_number=YOUR_CHOSEN_GPIO_NUMBER_HERE

To gpio_pin_number=21

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

Comments

DIY Hacks and How Tos (author)2016-12-10

Nice intro to Raspberry pi project. I am actually using this in a project that I am working on right now.

About This Instructable

135views

3favorites

License:

More by punkinlauncher:use a button to execute commands on a raspberry pi
Add instructable to: