Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4817

Troubleshooting • Issues with RPi.GPIO? Depreciated?

$
0
0
I'm working on a personal project, essentially to prove to myself I can.

and Sheesh, I'm having some edge-detect GPIO Issues. I've searched Google, and from what I can tell, it's an error or planned depreciation in the latest ( 3-15-2024 ) build of PiOS. something something kernel related or something I'm doing because I'm a novice. I'd try a older system image but I have no idea how to setup ssh and wireless without the Pi Tool, and the tuts I found online were incomplete. :shock:

Here's a summary of my current GPIO & python venv Setup:
1. 2 pins on PWM controlling a motor direction
2. I've hooked up the MCP3008 ADC per docs, and am reading it successfully, plotting results in pyplot
3. I need one pin to run edge detection from an encoder of a DC Motor, going to count pulses
4. I've installed stuff nto my venv that I didn't need to, but I don't call them in my script, and the errors didn't seem relevent
5. If you suspect it's my code, here it is.

Troubleshooting steps:
1. I've tried different GPIO Pins, Double checked wiring
2. Tried Sudo/Root, had issues with packages
3. sudo reboot & power cycled
4. tried RPi-lgpio ( gets error below )
5. Google

Relevent info:
1. Encoder pulses high @ 3.3v ( 60 times for every rotation of motor but the pin hasn't even seen that yet, because the script hasn't ran - it's thrown at enabling the Edge Detection before it powers up the motor.
2. Other GPi.GPIO tools work, like .pwm and .setmode, .setup
3. Running python3 in fresh venv. ( requirements.txt linked above )


Code:

  GPIO.cleanup()Traceback (most recent call last):  File "/home/MYFOLDER/Documents/testCutter/testcutter.py", line 39, in <module>    GPIO.add_event_detect(encoder_pin, GPIO.RISING, callback=encoder_callback)RuntimeError: Failed to add edge detection
I tried uninstalling RPi-GPIO and installing RPi-lgpio in my venv, but I'm getting this :shock:

Code:

(testCutter) MYFOLDER@testCutter:~/Documents/testCutter $ python testcutter.pyTraceback (most recent call last):  File "/home/MYFOLDER/Documents/testCutter/testcutter.py", line 1, in <module>    from RPi import GPIO as GPIO  File "/home/MYFOLDER/Documents/testCutter/testCutter/lib/python3.11/site-packages/RPi/GPIO/__init__.py", line 13, in <module>    import lgpioModuleNotFoundError: No module named 'lgpio'

I don't mean to sound jaded, but I hope it's some silly issue that I'm not seeing, that someone can point out to me. :geek: but it seems like RPi.GPIO is depreciated, and RPi.Lgpio has bugs with the latest build of the kernel.

Thanks to whomever take the time to help!

Statistics: Posted by fawwal — Mon Mar 25, 2024 7:03 pm



Viewing all articles
Browse latest Browse all 4817

Trending Articles