Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ferasaljoudi/simongame

A simple Simon game with 10 levels designed with C code using Keil uVision
https://github.com/ferasaljoudi/simongame

Last synced: 7 days ago
JSON representation

A simple Simon game with 10 levels designed with C code using Keil uVision

Awesome Lists containing this project

README

        


Simon Game


A simple Simon game designed with 10 levels using C code in Keil uVision, utilizing an STM32F103 Nucleo Board.




Overview


This project involves creating a Simon game that challenges the player to replicate sequences of lights generated by the system. The game is designed to run on an STM32F103 Nucleo Board and involves the use of LEDs and push buttons for user interaction. The game progresses through 10 levels of increasing complexity, providing feedback through LEDs for both successful and failed attempts.




Demo



Demo Gif




Technologies Used




C


Keil uVision


Stm32




Connection details


| Equipment | To Breadboard | To STM32 |
|:-------------------:|:-----------------:|:------------:|
| 1st pin in btn0 | GND | - |
| 1st pin in btn1 | GND | - |
| 1st pin in btn2 | GND | - |
| 1st pin in btn3 | GND | - |
| 2nd pin in btn0 | 10Kohm Bussed Resistor | PB4 |
| 2nd pin in btn1 | 10Kohm Bussed Resistor | PB6 |
| 2nd pin in btn2 | 10Kohm Bussed Resistor | PB8 |
| 2nd pin in btn3 | 10Kohm Bussed Resistor | PB9 |
| Cathode LED0 | GND | - |
| Cathode LED1 | GND | - |
| Cathode LED2 | GND | - |
| Cathode LED3 | GND | - |
| Cathode LED4 | GND | - |
| Anode LED0 | 270ohm Isolated Resistor | PA0 |
| Anode LED1 | 270ohm Isolated Resistor | PA1 |
| Anode LED2 | 270ohm Isolated Resistor | PA4 |
| Anode LED3 | 270ohm Isolated Resistor | PB0 |
| Anode LED4 | 270ohm Isolated Resistor | PA6 |




Description


1. Initialization:
- When the code runs, the 4 LEDs perform a classic Cylon Eye Scanner sequence.

2. Starting the Game:
- The game begins when the player presses the blue button on the STM32.
- The Cylon Eye Scanner stops, and the first round starts by generating a random light sequence.

3. Player Interaction:
- The player must mimic the light sequence by pressing the corresponding buttons within a limited time.
- If the player successfully replicates the sequence, a new light is added to the sequence for the next round.
- The game continues this way for up to 10 rounds.

4. Failure Condition:
- If the player fails to mimic the pattern correctly, presses the wrong button, or runs out of time, a failure sequence is triggered.
- The separated red LED blinks quickly for 3 seconds to indicate failure.
- The level reached by the player is then displayed in binary using the 4 LEDs.

5. Winning Condition:
- If the player successfully completes all 10 rounds, the 4 LEDs blink on and off together in celebration.




Resources


Here is a link to a YouTube video demonstrating the game:

- _[Click Here](https://www.youtube.com/watch?v=UqE-Zc_CKJw "Watch a demonstration of the Simon game")_