In the Xojo programming language, an Interrupt is created to accurately determine when a button has been pressed.
This example has code to run an interrupt which notifies the user when the button has been pressed, and does not take additional time or resources. Using the interrupt-option saves cycle resources on the Raspberry Pi and makes the program run faster. Switch debouncing has also been added.
Below is the electrical schematic for the Raspberry Pi.
Below is a screen grab from the running program.
The lgpio library can be installed Raspberry Pi OS (2026) and instructions are available at https://github.com/joan2937/lg (updated 2024)
Install instructions are:
- install Raspberry Pi OS (64-bit)
- Open a terminal and type the following commands:
- sudo apt install swig python3-dev
- sudo apt install python3-setuptools
- sudo apt install libunwind8
- wget https://github.com/joan2937/lg/archive/master.zip
- unzip master.zip
- cd lg-master
- make
- sudo make install
- create an Example program and copy the program and libraries to the RaspberryPi Desktop (make a 64-bit version)
- give the executable permission to run with something like: 'sudo chmod +x Example'
- run the program with something like: 'sudo ./Example'

