Reputation: 1
My code has been having issues, it is possible I may have to reflash the memory card with new OS since it worked previously on another Rasp Pi Zero 2.
But if anyone can help with this problem so it wont happen again I'd be grateful.
The issue comes with trying to use the function to detect a distance wheel rev change using the code as follows:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
#Distance Wheel
GPIO.setup(4, GPIO.IN)
def increaserev(channel):
global counter
counter += 1
GPIO.add_event_detect(4,GPIO.RISING, callback=increaserev)
This is a snippet of the code that still produces the same error when isolated. The full error is shown as:
Traceback (most recent call last) :
File "/home/pi/test.py", line 12, in <module>
GPIO.add_event_detect(4,GPIO.RISING, callback=increaserev)
RuntimeError: Failed to add edge detection
I have tried:
Upvotes: 0
Views: 530