Software flowcharts

While I’ve been waiting for the PCB to be made I’ve been working on designing the software. I’ve been using LucidChart to design flowcharts of the main systems.

Hand Controller

The Hand Controller sends a stream of data from the accelerometer and light trigger. It has a few different modes depending on whether the game needs data continuously or only when the trigger happens. There are two levels of detail for the accelerometer data – “Full” includes the full 16 bit resolution while the short version maps the -32k/+32k to 0 to 999. I believe the increase in speed for sending fewer bytes will be valuable. Also, I’m sending the values as ASCII numbers rather than just raw bytes to make it easier on the Mega side – with raw data it’s possible to interpret the data as control characters if it gets out of sync.

 

Mega Main System

Power On / Reset

Upon Power Up or Reset the system goes into Calibration mode, and then passes off to whichever game is selected.

Calibration

Calibration mode uses one of the potentiometers to set the length of the LED strip in meters, so that depending on the size of the available installation space I can use more or fewer strips. It also makes sure the hand controllers are working and displays a simple version of their data on the LED strip or 7 segment displays. The Start Button pulses for the user to press before the rotary switch works for game selection.

Game Loop

I designed a generic game loop (“Game N”) that each game will need to do, with the main game logic not included.

The HC Loop is setting up the Hand Controller(s) for each game. If the mode (CATF) is the same as a prior game then they will be sending valid data already, if not the player will need to hit the reset button on the controller. The need to reset the hand controller will be communicated by animation on the LED strips and possibly a message on the control panel displays. The flags are used to signify what animations to play to cue the players.

Once proper HC communication is set up the game waits for the start button, signified by a pulsing light on the button.

Play can be interrupted by restarting the game with the start button, or choosing a different game with the rotary switch.