e-paper は、秋葉原 千石通商で買いました(WaveShare 13354 2.7インチ 264×176 E-Ink 電子ペーパーモジュール for RaspberryPi)
実行すると、key1..4の押下と同時に標準出力へ 1..4 を出力します(Ctrl-Cで終了)
$ python3 button-13354-stdout.py
4
3
2
2
4
^C
Program interrupted. Cleaning up GPIO...
GPIO cleanup complete.
python3 button-13354-stdout.py | while read -r b; do
case "$b" in
1)
# key1を押した時の処理
curl -sSL 'https://example.com/api/v1/someapi?id=1¶m=a' &
;;
2)
# key2を押した時の処理
;;
3)
# key3を押した時の処理
sudo reboot
;;
4)
# key1を押した時の処理
;;
esac
done