Simon says lägga till text

Hej!
Håller på med mitt simon says projekt och är nu nästan klar.
Har problem att lägga in ett vinstmeddelande i koden som man ska se på displayen när man kommit till level 8 i spelet. Tar tacksamt emot förslag.

Simon_Says_V1.ino (10.0 KB)

for (int i = 0; i <= levelsInGame; i++) {
simonSaid[i] 

Don't write to memory you don't own.

Is this correct? i want the messege to show when level 8 is finnished

for (int i = 0; i <= levelsInGame; i++) {
simonSaid[i] =

display.clearDisplay();
display.setTextSize(2); // Draw 2X-scale text
display.setTextColor(WHITE);
display.setCursor(1, 0);
display.println("You won");
display.display(); // Show text
delay(2000);
}


#define levelsInGame 50
...
...
int simonSaid[levelsInGame];                //initialise the array
...
for (int i = 0; i <= levelsInGame; i++) {
simonSaid[i] =

Your simonSaid array has 50 elements, numbered 0 to 49.
Your for loop counts 0 to 50.

Do you see the problem?

Please remember to use code tags when posting code

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.