I am setting up some Raspberry Pis for use in demos to colleagues, in order to show off capabilities of the Pi itself, and of some of the add-on boards that are available.
I would really like to be able to maintain one cron-job/start-up script for all the possible demos I'm setting up, and have that script detect what HAT or older GPIO board is plugged in, so that I can trigger an appropriate demo script/program.
For example,
- If a SenseHAT is attached, then auto-start a Sense HAT Marble Maze
- If a Display-O-Tron HAT is attached, then auto-run the menu example
- If a PiTFT screen is attached, then auto-start a photo slide show
Is there any way to run Python, sh or similar, to detect which of some common GPIO boards is connected to a Pi?
Things I considered:
- Using information from Pinout.xyz to detect the pins in use, but that sounds like a lot of work.
Note that my intention is to auto-detect the configuration, without needing to attach a keyboard, ssh in, or similar - hence the wish for auto-detection, and why something like setting an environment variable wouldn't help.