The ultimate memory game

Placed on

Starting the game

We can use a button to start the game. I use button 1 to start. To let the player know that the game has started I created a short start animation where the LEDs go on 1 by 1. If you have done everything correctly and press button 1, the animation will start. Normally you could only press the button once.

Because nothing needs to be set I only show the main run.

lists

When we program we regularly use variables, but also often lists or Arrays. You can best see this as a book, where you have a title, with chapters below that all have a value. For example, in code it looks like this: order[] = ill use this function to store the sequence of LEDs. We also have storage for the number of 'chapters' or the length of the list.

apply lists

For starters, we're going to add a random number to the list each time.

We then use a piece of code to make the order of the LEDs go on and off each time

To see when it starts showing the sequence again I added this code at the end of the code:

Current Page 6. Programming (2) 1. Introduction 2. Buttons 3. The LEDs 4. The wiring 5. Programming (1) 6. Programming (2) 7. Programming (3) 8. A housing Posted by Student industrial sciences

Comments

Webwinkelkeur Kiyoh Trustpilot Opencircuit