Problems with GPIO

I have an timer application that needs to be visible on two monitors and be reset by a foot pedal. The screens are a 7" Pi touchscreen (DSI) and a HDMI monitor. I can only get these to behave properly under the latest Pi OS (bookworm). Unfortunately the GPIO library and wiringPi don’t work with that version of the OS. As a sanity check I I built a version of my program that runs on Buster and all works great with the old GPIO/winringPi stuff…

So I bought Eugene Dakin’s excellent book and tried pigpiod. Following the instructions on page 29 I tried to get the quickstart example running. The only variation was bringing in the latest pigpoid module (pigpio(7Jan2021).xojo_binary_code) to Example05-02-API2.xojo_binary_project. So far no luck!

It’s a Pi 4B

Here is some screen output:

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME=“Raspbian GNU/Linux 12 (bookworm)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“12”
VERSION=“12 (bookworm)”
VERSION_CODENAME=bookworm
ID=raspbian
ID_LIKE=debian
pi@raspberrypi:~ $ sudo apt-get install libunwind8
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
libunwind8 is already the newest version (1.6.2-3).
libunwind8 set to manually installed.
The following packages were automatically installed and are no longer required:
libcamera-apps libcamera0.0.5 libpisp0.0.1
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi:~ $ sudo systemctl enable pigpiod
Created symlink /etc/systemd/system/multi-user.target.wants/pigpiod.service → /lib/systemd/system/pigpiod.service.
pi@raspberrypi:~ $ sudo systemctl daemon-reload
pi@raspberrypi:~ $ sudo systemctl status pigpiod

  • pigpiod.service - Daemon required to control GPIO pins via pigpio
    Loaded: loaded (;;file://raspberrypi/lib/systemd/system/pigpiod.service/lib/systemd/system/pigpiod.service;;; enabled; preset: enabled)
    Active: inactive (dead)
    pi@raspberrypi:~

Yes, I rebooted several times…

I’m fairly sure if I can get past whatever problem I’m having with the example not lighting an LED I can get my program working.

What to do?

Never mind.

I wasn’t executing the program from a terminal window. Previously double clicking on the program in File Manager would make the program execute correctly. Worked that way with GPIO/wiringPi. With pigpiod it appears the program will execute but gpio functions don’t work. Same with Remote Debugger Desktop.

The fix is to either execute programs using sudo from a terminal window or make a shell script that will run the program when double clicked. It’s also handy to disable the prompt dialog by using File Manager, Edit, Preferences, General, and check the box “Don’t ask options on launch executable file”.

For my program I put a shell script called CountUp.sh on the desktop:

#!/bin/bash
cd /home/pi/CountUp
sudo ./CountUp

Everything works GREAT! Thanks to Mr Dakin for his efforts in keeping Xojo and R Pi a viable path for idiots like me!

Congratulations, and I am glad to see that you have the program working.

I am sure everyone (including yours truly) posts something on the forum and is then able to figure out the issue - which usually only happens after the submit button has been pressed :slight_smile:

Welcome to Xojo!