To create Ed's RV Ed-Splorer, this game's functionality was broken down into two main modules: the sensing and moving module, and the spotlight control module. Other supplemental modules were added to complete the functionality, including servo motion, LED text display, etc.
Sensing and Moving Module State Diagram
This module controls the player interaction. Beginning in an idle state, this module is but into use after a hand wave triggers a post from the Sensing and Moving Module. The then BRIGHTNESS_LEVEL_CONTROL state posts to the LED_Display_module and PWMModules to communicate with the player and react to their button-pressing interaction.
During gameplay, the MOVING state is used to react to the joystick event checker and post events to the PWMModule and move the spotlight servos accordingly. At the conclusion of gameplay, this module resets into the BRIGHTNESS_LEVEL_CONTROL mode and the user can replay if they choose.
SpotlightControl Module State Diagram
Implementing a state machine that handles how would the Target LEDs light in several sequences during the game, after losing, and after winning
TargetLEDs Module State Diagram
State machine implementation to produce different tones at different occasions during the game according to BuzzerService state machine provided in the software design document
BuzzerService State Diagram
State machine implementation that takes care of printing different messages on the LED matrix display
LED Display Module State Diagram
This module is a simple service updating the 3 servos (spotlight two degrees of freedom and indicator servo) current angles as well as the spotlight intensity.Â
This module is a simple service scanning the inputs from Joystick every predefined period of time and send the values to the PWMService through global variables to get the spotlight moving when it is supposed to be in motion (during the game).