を私はgpiozero
とRPi.GPIO
の両方を使用して、異なるアプローチを試みラズベリーパイ3モデルB. は、エッジ検出の追加に失敗しました - ラズベリーパイ3 GPIO
を使用しています。この問題は、使用するライブラリに関係なく発生します。
gpiozero
で失敗するコードの例を次に示します。
from gpiozero import Button
from signal import pause
def handle():
print("Pressed!")
button = None
while not button:
try:
button = Button(4, pull_up=True)
button.when_pressed = handle
except RuntimeError as e:
print(e)
pass
pause()
ラインbutton = Button(4, pull_up=True)
は常にRuntimeError
と(python3
を実行している)プログラムの出力を上昇させている。
Failed to add edge detection
Failed to add edge detection
Failed to add edge detection
Failed to add edge detection
# ... it goes on for ages
私はすでにRPi.GPIO
とgpiozero
を再インストールしようとしたが、それは助けにはなりませんでした。ここで
は私もArch_armオペレーティングシステムとラズベリーのPI3 Bに同じ問題を取得し、例外
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gpiozero/input_devices.py", line 84, in __init__
self.pin.when_changed = self._fire_events
File "/usr/lib/python3/dist-packages/gpiozero/pins/__init__.py", line 240, in <lambda>
lambda self, value: self._set_when_changed(value),
File "/usr/lib/python3/dist-packages/gpiozero/pins/rpigpio.py", line 233, in _set_when_changed
bouncetime=self._bounce)
RuntimeError: Failed to add edge detection