Chapter 4: A Change Of Command

Day 12: New Cadet Quality Tester

To keep the crew mentally sharp and entertained, the new commander has requested a game that challenges the cadets’ memory. As a cadet, you are tasked with creating “Space Memory Match,” a game where LEDs flash in a sequence that the players must remember and replicate. With each round, the sequence gets longer, testing the cadets’ memory and concentration. This game will help improve their cognitive abilities and provide a fun, engaging activity aboard the Nebula Raider.


Components Needed:


Raspberry Pi Pico WH Microcontroller

LEDs (4, different colors or positions)

Push buttons (matching the number of LEDs)

Buzzer (optional for sound feedback)

LCD1602 IIC/I2C Blue Backlight Display

Resistors

Breadboard

Jumper wires

Instructions:


Set Up the Circuit:


Connect each LED to a GPIO pin on the Raspberry Pi Pico (e.g., GP0, GP1, GP2, GP3) with appropriate resistors.

Connect each push button to a GPIO pin on the Raspberry Pi Pico (e.g.,

GP4, GP5, GP6, GP7) using a pull-down resistor configuration.

Connect the LCD1602 display to the Raspberry Pi Pico using the I2C interface (SDA to GP8, SCL to GP9).

Optionally, connect a buzzer to a GPIO pin on the Raspberry Pi Pico (e.g., GP10) for sound feedback when a button is pressed.

Circuit Diagram

Write the Code:


Open your coding environment and write the following Python code to create the Space Memory Match game.

Test the System:

Upload the code to the Raspberry Pi Pico and run it.

Observe the LEDs flashing in a sequence and try to replicate it by pressing the corresponding buttons.

Ensure the system accurately verifies the user input and provides feedback on the LCD.


Learning Outcomes: