Thx , Tried your script, got an error, have I not installed something??
import gpiod
import time
from gpiod.line import Direction, Value
LINE = 27
with gpiod.request_lines("/dev/gpiochip0",consumer="read-example",config={ LINE: gpiod.LineSettings(direction=Direction.INPUT) },) as request:
while True:
x = request.get_value(LINE)
time.sleep(1)
print ("GPIO 27 =",x)
Traceback (most recent call last):
File "/home/hoekemolenkap/mu_code/line.py", line 3, in <module>
from gpiod.line import Direction, Value
ModuleNotFoundError: No module named 'gpiod.line'; 'gpiod' is not a package
import gpiod
import time
from gpiod.line import Direction, Value
LINE = 27
with gpiod.request_lines("/dev/gpiochip0",consumer="read-example",config={ LINE: gpiod.LineSettings(direction=Direction.INPUT) },) as request:
while True:
x = request.get_value(LINE)
time.sleep(1)
print ("GPIO 27 =",x)
Traceback (most recent call last):
File "/home/hoekemolenkap/mu_code/line.py", line 3, in <module>
from gpiod.line import Direction, Value
ModuleNotFoundError: No module named 'gpiod.line'; 'gpiod' is not a package
Statistics: Posted by Bregt — Sun Sep 15, 2024 12:59 am