Your task is to implement the game of Simon on the QUTy. This game produces a sequence of lights and tones and requires a user to reproduce this sequence. If the user succeeds, the sequence becomes progressively longer.

Summary

Your task is to implement the game of Simon on the QUTy.

This game produces a sequence of lights and tones and requires a user to reproduce this sequence. If the user succeeds, the sequence becomes progressively longer.

On the QUTy, the four pushbuttons will perform the function of the four coloured buttons in the Simon game. Each pushbutton will be mapped to the vertical segments directly above it on the 7-segment display and for each press of a pushbutton, a tone will sound.

Functionality
Your programme is required to implement the following core functionality:

A. Gameplay

  • Upon system reset, or at the start of anew game, the sequence length is set to one. The user’s score is equal to the sequence length.
  • On each turn of gameplay, “Simon” will sound a sequence of tones using the buzzer, and as each tone is sounded, the corresponding segments of the 7-segment display will be lit (see Table 1). The tone will play, and the display segments will be lit for 50% of the duration of the playback delay (set by the potentiometer—see section C). The tone will then stop, and all display segments will be turned OFF for the remainder of the playback delay. Following this, the next note in the sequence will
    be played.

B. The Sequence

  • The sequence displayed by Simon comes from a pseudo-random sequence seeded by the digits of your student number.
  • Upon system reset, the pseudo-random sequence seed will be set back to its initial value, allowing the Simon game to be replayed.

C. Playback Delay

  • The playback delay will be read from the potentiometer and will range between 0.25 to 2.0 seconds. The playback delay is used to control several aspects of the game as discussed in Section A.
  • The playback speed can be increased by turning the potentiometer clockwise (direction when facing the potentiometer).

D. Playback Frequency

  • The playback frequencies of the four tones will default to the values derived from your student number, as shown in Table 2.
  • The octave of the playback frequencies can be increased by receiving an “INC FREQ” token through the UART.

 

E. Gameplay through UART

Gameplay, INC/DEC FREQ, RESET and SEED:

  • Instead of pressing the buttons on the QUTy board, the user may press certain keys in the serial monitor. The ASCII characters are sent to the QUTy over the UART, and perform the same actions as the pushbuttons.
  • The UART interface will be configured to 9600—8-N-1