The German
Posts: 11
Joined: Sun Feb 08, 2015 9:49 pm

Access GPIO from multiple instances?

Sun Feb 08, 2015 10:01 pm

I am running a shell with a python script that is monitoring a physical button

Code: Select all

GPIO.setup(37, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.add_event_detect(37, GPIO.RISING, callback=MenuButton, bouncetime=300)
That works just fine and the MenuButton function is being called when the button gets pressed and released.

Now, for testing purposes, I want to trigger the RISING event from the outside our of another shell / script. The problem is that the GPIO port seems to be exclusive to a single script running, or?

Any thoughts how to get this done are greatly appreciated!

User avatar
Posts: 14472
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Access GPIO from multiple instances?

Sun Feb 08, 2015 11:33 pm

Couldn't you just connect another gpio to the switch gpio? To trigger the rising edge set the other gpio as an output and write 1. Probably best to put a 10k or so resistor in series with the triggering gpio.

Return to “Beginners”