RPi.GPIO sudo versus sudo-less performance differences
Posted: Thu Nov 12, 2015 11:43 pm
Hey guys!
I've recently just updated RPi.GPIO to 0.6.0a3 in order to be able to access the GPIO pins from not root. However, I've noticed a very annoying behaviour (that I think has also been documented viewtopic.php?t=124738.
Basically, 70%-90% of the time when trying to either GPIO.wait_for_edge or GPIO.add_event_detect I get the following Runtime Error:
RuntimeError: Failed to add edge detection or RuntimeError: Error waiting for edge
However running the code under sudo never has any runtime errors.
Does anyone have any ideas what could be causing this problem?
(Here is some example code):
I've recently just updated RPi.GPIO to 0.6.0a3 in order to be able to access the GPIO pins from not root. However, I've noticed a very annoying behaviour (that I think has also been documented viewtopic.php?t=124738.
Basically, 70%-90% of the time when trying to either GPIO.wait_for_edge or GPIO.add_event_detect I get the following Runtime Error:
RuntimeError: Failed to add edge detection or RuntimeError: Error waiting for edge
However running the code under sudo never has any runtime errors.
Does anyone have any ideas what could be causing this problem?
(Here is some example code):
Code: Select all
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
def call(channel):
print "callback"
GPIO.add_event_detect(25, GPIO.RISING, callback=call)
try:
GPIO.wait_for_edge(24, GPIO.RISING)
except KeyboardInterrupt:
print "Exit"
GPIO.cleanup()