05-20-2024, 06:57 PM
(This post was last modified: 05-27-2024, 02:03 PM by Tim Curtis.
Edit Reason: Mark solved
)
I have a single GPIO button defined on my Pi3A+ based player but alas it's no longer working in moOde 9.
On another thread, Tim found this:
A bit of search on the interweb tells me that "NoneType" is Python for "null" so I'm not sure why that applies to the output from datetime.. Anyway, I did a bit of digging in my own system and find different errors.
With the GPIO button configured, but not activated the script runs cleanly and printls out the configuration:
The Killed at the end is when I enabled the button through the UI.
When the button is enabled:
From which I understand I just need to set the value of the "pull" variable to be PUD_UP rather than GPIO.PUD_UP. I think this is set in the configuration database via the UI, so hopefully someone can point me at where that happens and I can test to see if that fixes things.
I have no idea why Tim got the NoneType error when I didn't though...
On another thread, Tim found this:
Code:
pi@moode9:~ $ sudo /var/www/daemon/gpio_buttons.py
2024-05-20 07:44:17 bounce_time=1000
Traceback (most recent call last):
File "/var/www/daemon/gpio_buttons.py", line 43, in <module>
print(str(datetime.datetime.now())[:19] +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: can only concatenate str (not "NoneType") to str
A bit of search on the interweb tells me that "NoneType" is Python for "null" so I'm not sure why that applies to the output from datetime.. Anyway, I did a bit of digging in my own system and find different errors.
With the GPIO button configured, but not activated the script runs cleanly and printls out the configuration:
Code:
master@prometheus:~ $ sudo /var/www/daemon/gpio_buttons.py
2024-05-20 15:45:21 bounce_time=1000
2024-05-20 15:45:21 row1, pin27, enabled=0, pull=GPIO.PUD_UP, command=/home/master/StartStop.sh
2024-05-20 15:45:21 row2, pin2, enabled=0, pull=GPIO.PUD_UP, command=
2024-05-20 15:45:21 row3, pin2, enabled=0, pull=GPIO.PUD_UP, command=
2024-05-20 15:45:21 row4, pin2, enabled=0, pull=GPIO.PUD_UP, command=
2024-05-20 15:45:21 row5, pin2, enabled=0, pull=GPIO.PUD_UP, command=
2024-05-20 15:45:21 row6, pin2, enabled=0, pull=GPIO.PUD_UP, command=
2024-05-20 15:45:21 row7, pin2, enabled=0, pull=GPIO.PUD_UP, command=
2024-05-20 15:45:21 row8, pin2, enabled=0, pull=GPIO.PUD_UP, command=
Killed
When the button is enabled:
Code:
master@prometheus:~ $ sudo /var/www/daemon/gpio_buttons.py
2024-05-20 15:46:33 bounce_time=1000
2024-05-20 15:46:33 row1, pin27, enabled=1, pull=GPIO.PUD_UP, command=/home/master/StartStop.sh
Traceback (most recent call last):
File "/var/www/daemon/gpio_buttons.py", line 50, in <module>
GPIO.setup(btn_1_pin, GPIO.IN, pull_up_down=btn_1_pull)
File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 647, in setup
raise ValueError(
ValueError: Invalid value for pull_up_down - should be either PUD_OFF, PUD_UP or PUD_DOWN
I have no idea why Tim got the NoneType error when I didn't though...
----------------
Robert
Robert