This is the sourcecode for the Pandemic shuffle board. The code is written for this purpose only. The code is public for you to learn from or to be inspired. You may use it, but only at your own risk. There is no warranty. Feel free to use the discussions section in GitHub for questions.
The IOModule code is made for the Arduino Nano Every. The Pandemic code is for the Raspberry Pi running Raspbian Lite (but it might work on other distros, I don't know). But the software is pretty useless without the hardware setup as described in the article. It needs the LED display and sensors and buttons via the Arduino, etc.
The IOModule code is easiest to compile and upload with the Arduino IDE, or with Visual Micro. It doesn't get more straight forward.
The Pandemic code is compiled on the Raspberry Pi using Visual Studio from a Windows machine connected to the same network. To make this work, you need to install the following packages on the Raspberry Pi:
sudo apt install zip rsync openssh-server build-essential gdbserver git
Visual Studio automatically copies the changed files to the Raspberry Pi and remotely builds the project. The binaries are built in ~/projects/Pandemic/bin/... with a Debug or Release subdirectory depending on the chosen build configuration.
There is a post-build action which should copy the required librgbmatrix.so library to the same output directory. This was previously built from Henner Zeller's rpi-rgb-led-matrix library. Follow his instructions to build that library.
To install fmod, download the fmod engine version 2.02.11 to the Raspberry Pi and unzip it in the ~/projects directory. This will create a subdirectory named fmodstudioapi20211linux
which contains headers and dynamic link libraries. You may also choose to get a newer version or unzip it in any other location, but then don't forget to update the include paths in the project file before building. In the file /etc/ld.so.conf
add a line to the directory containing the .so files: /home/pi/projects/fmodstudioapi20211linux/api/core/lib/arm64
. Then run sudo ldconfig
to apply the changes. You should now be able to compile and link fmod.
The file pandemic.toml
is copied to the output directory on build. This file is read by the software on startup. You may want to make changes to this file depending on platform (RPI or VM) and personal preferences.
The data files must be in the directory /usr/local/games/data/, however, this is configurable in pandemic.toml
. There is a handy batch file named Deploy_Data.bat
to copy the data.
To work on the software without any of the hardware, you must use the IOModule simulator and Raspberry Pi Desktop OS in a virtual machine.
Here is how to set it up:
pandemic
and login to pi
to match with my real Rapsberry Pi, but I don't think this is really needed.In the virtual machine settings (with the virtual machine turned off), go to "Serial Ports" and configure Port 1 as follows:
\\.\pipe\pandemic_iomodule
This will allow the IOModule simulator to talk with the virtual machine.
pandemic.toml
file, in the IO
section, set SerialPort = "/dev/ttyS0"
. This makes the software talk with the configured COM1 port.xhost +si:localuser:$USER
and in Visual Studio, go to the project properties, then to Debugging and add export DISPLAY=:0
to the Pre-Launch Command. This allows you to open an X11 window from a remote SSH connection.If you did everything above, you should now be able to do this:
Credit to whom credit is due. I'm using the following software libraries:
The following tools and resources were used: