(late) memory game on Arduino

Inspiration:

This week I decided to make a game, and the memory game came to mind first. I remember that in high school, when I found out about the existence of Arduino, I wanted to make it but then I didn’t have enough time or knowledge. I’m glad I did it now as part of this course.

Game Rules:

The game starts with three flashing LEDs. To start the sequence, user should turn on red LED with potentiometer (analog input). Then, the random LED starts to light up, and the player must press the button of the same color within 2.5 seconds after it goes out. Then another LED lights up, and so their number increases. If the player messes up the order or does not have time for 2.5 seconds, the game ends, the LEDs light up again until the game starts again automatically.

Problems and Solutions:

  • It took me much longer than I expected. I started from doing the easiest circuits from the class until I did my own circuit with 3 LEDs, 3 button, 1 potentiometer, and 8 resistors. After that, I started coding the game. I visited multiple tutorials/examples and this, this, and this were he most helpful. To be fair, I discovered these useful resources very late, so I’ve done most of the coding myself and only then changed it to much more convenient ways. Learned a lot, honestly.
  • I used randomSeed() to make the random LED light up
  • To add analog input, I did it as a start for the game and added to the first if statement
  • Resistors and buttons are hard to add to the board…

Final result!!!

Code: https://github.com/Alima2104/first-arduino-game

Leave a Reply