When using the following code to read pulses from this sensor
[ ... ]
the following error occurs
GPIO.add_event_detect(2, GPIO.FALLING, callback=impulse) # определение внешнего прерывания
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Failed to add edge detection
how can it be solved if I have already tried to use other functions of this library, nothing helps. Although before reinstalling the OS this code worked more than correctly, but after updating the OS no.
A 2-part reply -
Python code relies on indentation (left-hand white space) for its syntax. The forum software provides [_Code_ ] tag markup to preserve indentation. This is found on the fifth 'button' from the left at the top of the message entry screen. You can - and should - retrospectively correct your post.
The [ PREVIEW ] button is useful for checking the presentation of your post.
The RPi.GPIO python library is not recommended or supported by Raspberry Pi, and as you have found recent updates to RasPiOS have made it unusable in some circumstances. [Although it is not part of your requirement, RPi.GPIO is not usable on an RPi[5] board at all.]
Raspberry Pi official documentation suggests the use of the gpiozero library as an alternative.
Ref: Use GPIO from Python - https://www.raspberrypi.com/documentati ... rom-python
Statistics: Posted by B.Goode — Fri Sep 06, 2024 11:28 am