With Pimoroni Button SHIM device you can have fast and easily 5 physical buttons and one LED on your device. What you do with it is up to you, the possibilities are almost unlimited.
The aim of this tutorial is to describe the configuration of Raspberry PI, the installation of the necessary software. Additional a tiny test whether everything is ready for further development.
Attention: You have to solder the components beforehand, this is not described here!
My Button SHIM on Raspberry Pi Zero and Flirc Case.
You should already have read (and successful carried out) the following tutorials.
Install (or ensure they are installed) following packages.
# update system (optional)
$ sudo apt update -y && sudo apt upgrade -y
Enable the I2C interface on the Raspberry Pi.
# start console based raspi-config application
$ sudo raspi-config
Select Interfacing Options
, next I2C
and activate <Yes>
.
# install button shim package
$ sudo apt install -y python3-buttonshim
# start python console
$ python3
Test the device LED.
# import button shim library
>>> import buttonshim
# LED light up red
>>> buttonshim.set_pixel(0xff, 0x00, 0x00)
# LED light up green
>>> buttonshim.set_pixel(0x00, 0xff, 0x00)
# LED light up blue
>>> buttonshim.set_pixel(0x00, 0x00, 0xff)
# exit python console
>>> exit()
Note: Read this documentation to get more information, or have a look on these GitHub examples to start faster.