Use a Button to Execute Commands on a Raspberry Pi

Intro: 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

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

Share

    Recommendations

    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge
    • Plastics Contest

      Plastics Contest
    • Audio Contest 2018

      Audio Contest 2018

    2 Discussions

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

    1 reply