4

How can I disable a GPIO pin or set it to off whenever I execute a method in Python?

7
  • 3
    What do you mean by disable, are you writing or reading from the pin? – Steve Robillard May 5 '15 at 7:19
  • 3
    Use a wire cutter – Werner Kvalem Vesterås May 5 '15 at 7:40
  • 1
    Why not just ignore the reset gpio if the stopwatch is running? – joan May 5 '15 at 9:47
  • 1
    Kind of. You want to set some kind of state variable such that when you don't want the reset button to work, it won't work. meta.stackexchange.com/questions/66377/what-is-the-xy-problem/… When a program is busy doing something and some GUI controls are invalid for that time, it does not disable the mouse, but if you click the mouse pointer on those controls, nothing will happen. That's what state is about. There's more than one state, and if something cannot happen in all of them, you need to check what the state currently is first before you allow it. – goldilocks May 5 '15 at 19:11
  • 1
    @WernerKvalemVesterås that won't disable the pin, just make it shorter. You should know that. – PhillyNJ May 5 '15 at 19:14
2
sudo echo 11 > /sys/class/gpio/unexport

To disable GPIO pin 11.

0

I'm going to go out on a limb and guess that whatever you want will be handled by one of the software libraries mentioned at http://elinux.org/RPi_Low-level_peripherals#GPIO_Code_examples

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.