The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: GPIO buttons on moOde 9.
#1
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:

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
The Killed at the end is when I enabled the button through the UI.

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
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...
----------------
Robert
Reply


Messages In This Thread
GPIO buttons on moOde 9. - by the_bertrum - 05-20-2024, 06:57 PM
RE: GPIO buttons on moOde 9. - by Tim Curtis - 05-20-2024, 07:09 PM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-20-2024, 07:51 PM
RE: GPIO buttons on moOde 9. - by TheOldPresbyope - 05-20-2024, 08:22 PM
RE: GPIO buttons on moOde 9. - by Tim Curtis - 05-20-2024, 08:30 PM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-20-2024, 09:42 PM
RE: GPIO buttons on moOde 9. - by Tim Curtis - 05-20-2024, 10:37 PM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-21-2024, 07:57 AM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-21-2024, 08:03 AM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-21-2024, 08:40 AM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-21-2024, 08:51 AM
RE: GPIO buttons on moOde 9. - by Tim Curtis - 05-21-2024, 11:16 AM
RE: GPIO buttons on moOde 9. - by Dorffen - 05-21-2024, 09:09 AM
RE: GPIO buttons on moOde 9. - by Tim Curtis - 05-22-2024, 01:08 PM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-22-2024, 01:25 PM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-22-2024, 02:09 PM
RE: GPIO buttons on moOde 9. - by Tim Curtis - 05-22-2024, 06:56 PM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-26-2024, 03:33 PM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-26-2024, 05:17 PM
RE: GPIO buttons on moOde 9. - by Tim Curtis - 05-26-2024, 06:13 PM
RE: GPIO buttons on moOde 9. - by Tim Curtis - 05-26-2024, 07:02 PM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-27-2024, 12:28 PM
RE: GPIO buttons on moOde 9. - by Tim Curtis - 05-27-2024, 12:54 PM
RE: GPIO buttons on moOde 9. - by the_bertrum - 05-27-2024, 01:51 PM

Forum Jump: