Video above shows a demo our of final project!

Assignment Instructions

Group members: Grace Chen & Avery Moorhead

Final Report

Introduction:

Our final project is a marble maze game where a user moves the marble through the LEGO maze by manipulating the joystick, which tilts the maze and therefore moves the marble. The marble maze game also included stop and start sensors to determine the position of the ball in the game, a seven segment display and two LEDs to display game states, and two buttons to turn off the game and control the game mode.

Our initial approach to this project was to break the project into sections. First, we wrote code for the x and y axis motors that control the tilting of the board. After that was done, we moved onto the photodetectors and making sure they trigger correctly when they are armed versus unarmed. Following this we created our game state, BEFORE, PLAY, and STOP, which are dependent on the states of the photodetectors. After this, we moved on to making sure the LEDs behaved properly in their respective states, and wrote the code to turn on/off the seven segment display. After each major portion of the game was completed, we created the on/off state for the game and worked on debugging any issues that came up while organizing and updating our game. After this, we built our four additional features. These were blinking leds, stopwatch, a fastest time display, and a cheating detector. First, we had the red and green LED change depending on the state of the game. If we were in the BEFORE state, then both leds blink in the start sequence, the green LED stays on for the PLAY state, and then the red LED stays on for the STOP state. For the stopwatch feature, we had a stopwatch, that counts up to a maximum value of 120, turned on once the user button is pressed. Next, the seven segment display displays the fastest time for maze completion if the user or users decide to play in the timed stopwatch state. Lastly, we created a cheating feature, to ensure that the user cannot play the game (and record a fastest score), if they start before the 3..2.1..GO displayed on the seven segment ends. See Game Logistics for more information about how the game works.