You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good morning, according to the documentation pins 29 to 40 are used only not in the case of a single panel and that is why I would like to use it to read a sensor, but it keeps giving me error :
fabio@raspberrypi:~/project/projectPanelLed $ sudo python test3.py
Traceback (most recent call last):
File "/home/fabio/project/projectPanelLed/test3.py", line 21, in <module>
File "/usr/local/lib/python3.11/dist-packages/Adafruit_DHT/common.py", line 81, in read
return platform.read(sensor, pin)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/Adafruit_DHT/Raspberry_Pi_2.py", line 34, in read
raise RuntimeError('Error accessing GPIO.')
RuntimeError: Error accessing GPIO.
I ask why I can't read sensor if the sensor test code is this.
import time
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import Adafruit_DHT
options = RGBMatrixOptions()
options.rows = 64
options.cols = 64
options.chain_length = 1 # only one panel
options.parallel = 1
options.hardware_mapping = 'regular'
matrix = RGBMatrix(options=options)
DHT_SENSOR = Adafruit_DHT.DHT11
DHT_PIN = 26 # Use an unused pin if there are conflicts
while True:
humidity, temperature = Adafruit_DHT.read(DHT_SENSOR, DHT_PIN)
if humidity is not None and temperature is not None:
print(f'Temperature: {temperature:.1f}°C, Humidity: {humidity:.1f}%')
else:
print(“Error reading the sensor.”)
time.sleep(2)
Or the program give me this error
python3 test2.py
Traceback (most recent call last):
File "/home/fabio/project/projectPanelLed/test2.py", line 59, in <module>
File "/home/fabio/project/projectPanelLed/test2.py", line 41, in get_sensor_data
RuntimeError: No access to /dev/mem. Try running as root
whoami
root
PS: the sensor works since with other scripts the required output comes out.
The text was updated successfully, but these errors were encountered:
Good morning, according to the documentation pins 29 to 40 are used only not in the case of a single panel and that is why I would like to use it to read a sensor, but it keeps giving me error :
I ask why I can't read sensor if the sensor test code is this.
Or the program give me this error
PS: the sensor works since with other scripts the required output comes out.
The text was updated successfully, but these errors were encountered: