'reeks' dos not name a type.

Hello everyone, I am having a little problem with my code.

It is supposed to be a memory game like simon says.

i get the error “Reeks does not name a type”

//Joystick
const int X_pin = A4;
const int Y_pin = A5;
int Joy_Waarde;
//leds
const int led_Rood = 13;
const int led_Groen = 12;
const int led_Blauw = 11;
const int led_Geel = 10;
//componenten
const int buzzer = 4;

//reeks
const int reeksMax = 100;
int reeks[reeksMax];
int reeksIndex = 0;


int X_Value = 0;//Waarde X-Axis Joystick
int Y_Value = 0;//Waarde Y-Axis Joystick


void setup() {
  randomSeed(analogRead(0));
  pinMode (led_Rood, OUTPUT);
  pinMode (led_Groen, OUTPUT);
  pinMode (led_Blauw, OUTPUT);
  pinMode (led_Geel, OUTPUT);

  pinMode(buzzer, OUTPUT);


  Serial.begin(9600);
  Serial.println("Het spel is begonnen!");
}
void loop() {
  X_Value = analogRead(X_pin);
  Y_Value = analogRead(Y_pin);

  int joy_Blauw = (X_Value == 0);
  int joy_Groen = (X_Value == 1023);
  int joy_Geel = (Y_Value == 1023);
  int joy_Rood = (Y_Value == 0);

  if (joy_Groen == HIGH) {
    digitalWrite(led_Groen, HIGH);
  } else {
    digitalWrite(led_Groen, LOW);
  }
  if (joy_Blauw == HIGH) {
    digitalWrite(led_Blauw, HIGH);
  } else {
    digitalWrite(led_Blauw, LOW);
  }
  if (joy_Geel == HIGH) {
    digitalWrite(led_Geel, HIGH);
  } else {
    digitalWrite(led_Geel, LOW);
  }
  if (joy_Rood == HIGH) {
    digitalWrite(led_Rood, HIGH);
  } else {
    digitalWrite(led_Rood, LOW);
  }

}
int leds = random(10, 14);
reeks[reeksIndex] = leds;
for (int i = 0; i = reeksMax;) {
  reeksIndex = 0;
}
delay(5000);

void reset() {
 int i = 0;
  for (i = 0; i < 4; i++) {
    digitalWrite(led_Rood, HIGH);
    digitalWrite(led_Geel, HIGH);
    digitalWrite(led_Blauw, HIGH);
    digitalWrite(led_Groen, HIGH);
    delay (500);
    digitalWrite(led_Rood, LOW);
    digitalWrite(led_Geel, LOW);
    digitalWrite(led_Blauw, LOW);
    digitalWrite(led_Groen, LOW);
  }
  reeksIndex = 0;
  delay(3000);
}
while (huidig > reeksIndex) {
  int laatste_Joy = 0;
  while (joy_Rood == HIGH || joy_Geel == HIGH || joy_Groen == HIGH || joy_Blauw == HIGH) {
    if (joy_Rood == HIGH) {
      laatste_Joy = led_Rood;
      digitalWrite(led_Rood, HIGH);
    } else {
      digitalWrite(led_Rood, LOW);
    }
    if (joy_Geel == HIGH) {
      laatste_Joy = led_Geel;
      digitalWrite(led_Geel, HIGH);
    } else {
      digitalWrite(led_Geel, LOW);
    }
    if (joy_Groen == HIGH) {
      laatste_Joy = led_Groen;
      digitalWrite(led_Groen, HIGH);
    } else {
      digitalWrite(led_Groen, LOW);
    }
    if (joy_Blauw == HIGH) {
      laatste_Joy = led_Blauw;
      digitalWrite(led_Blauw, HIGH);
    } else {
      digitalWrite(led_Blauw, LOW);
    }

  }
  digitalWrite(laatste_Joy, LOW);
  if (laatste_Joy != 0){
    if (reeks[huidig] != laatste_Joy){
      reset();
      laatste_Joy = 0;
      break;
    }else{
      huidig++;
      laatste_Joy = 0:;
    }
  }
}

Thank you in advance!

Look carefully where your loop() function ends.

Edit: and your reset () function

for (int i = 0; i = reeksMax;) That's not going to go well.

Thank you for your reply, I think i fixed both of your answers.

I now get an error "a function-definition is not allowed here before '{' token (void reset)

Could you help me with that?

Thank you very much!

Could you help me with that?

Without seeing your code?
Not a hope.

sorry!

here is the code.

void reset() {
 
  for (i = 0; i < 4; i++) {
    digitalWrite(led_Rood, HIGH);
    digitalWrite(led_Geel, HIGH);
    digitalWrite(led_Blauw, HIGH);
    digitalWrite(led_Groen, HIGH);
    delay (500);
    digitalWrite(led_Rood, LOW);
    digitalWrite(led_Geel, LOW);
    digitalWrite(led_Blauw, LOW);
    digitalWrite(led_Groen, LOW);
  }
  reeksIndex = 0;
  delay(3000);
}

All of the code.

Sorry I am new to this.

//Joystick
const int X_pin = A4;
const int Y_pin = A5;
int Joy_Waarde;
//leds
const int led_Rood = 13;
const int led_Groen = 12;
const int led_Blauw = 11;
const int led_Geel = 10;
//componenten
const int buzzer = 4;

//reeks
const int reeksMax = 100;
int reeks[reeksMax];
int reeksIndex = 0;

int X_Value = 0;//Waarde X-Axis Joystick
int Y_Value = 0;//Waarde Y-Axis Joystick


void setup() {
  randomSeed(analogRead(0));
  pinMode (led_Rood, OUTPUT);
  pinMode (led_Groen, OUTPUT);
  pinMode (led_Blauw, OUTPUT);
  pinMode (led_Geel, OUTPUT);

  pinMode(buzzer, OUTPUT);


  Serial.begin(9600);
  Serial.println("Het spel is begonnen!");
}
void loop() {
  X_Value = analogRead(X_pin);
  Y_Value = analogRead(Y_pin);

  int joy_Blauw = (X_Value == 0);
  int joy_Groen = (X_Value == 1023);
  int joy_Geel = (Y_Value == 1023);
  int joy_Rood = (Y_Value == 0);

  int i = 0;

  if (joy_Groen == HIGH) {
    digitalWrite(led_Groen, HIGH);
  } else {
    digitalWrite(led_Groen, LOW);
  }
  if (joy_Blauw == HIGH) {
    digitalWrite(led_Blauw, HIGH);
  } else {
    digitalWrite(led_Blauw, LOW);
  }
  if (joy_Geel == HIGH) {
    digitalWrite(led_Geel, HIGH);
  } else {
    digitalWrite(led_Geel, LOW);
  }
  if (joy_Rood == HIGH) {
    digitalWrite(led_Rood, HIGH);
  } else {
    digitalWrite(led_Rood, LOW);
  }


  int leds = random(10, 14);
  reeks[reeksIndex] = leds;
  for (i = 0; i = reeksMax;) {
    reeksIndex = 0;
  }
  delay(5000);

void reset(){

    for (i = 0; i < 4; i++) {
      digitalWrite(led_Rood, HIGH);
      digitalWrite(led_Geel, HIGH);
      digitalWrite(led_Blauw, HIGH);
      digitalWrite(led_Groen, HIGH);
      delay (500);
      digitalWrite(led_Rood, LOW);
      digitalWrite(led_Geel, LOW);
      digitalWrite(led_Blauw, LOW);
      digitalWrite(led_Groen, LOW);
    }
    reeksIndex = 0;
    delay(3000);

    while (huidig > reeksIndex) {
      int laatste_Joy = 0;
      while (joy_Rood == HIGH || joy_Geel == HIGH || joy_Groen == HIGH || joy_Blauw == HIGH) {
        if (joy_Rood == HIGH) {
          laatste_Joy = led_Rood;
          digitalWrite(led_Rood, HIGH);
        } else {
          digitalWrite(led_Rood, LOW);
        }
        if (joy_Geel == HIGH) {
          laatste_Joy = led_Geel;
          digitalWrite(led_Geel, HIGH);
        } else {
          digitalWrite(led_Geel, LOW);
        }
        if (joy_Groen == HIGH) {
          laatste_Joy = led_Groen;
          digitalWrite(led_Groen, HIGH);
        } else {
          digitalWrite(led_Groen, LOW);
        }
        if (joy_Blauw == HIGH) {
          laatste_Joy = led_Blauw;
          digitalWrite(led_Blauw, HIGH);
        } else {
          digitalWrite(led_Blauw, LOW);
        }

      }
      digitalWrite(laatste_Joy, LOW);
      if (laatste_Joy != 0) {
        if (reeks[huidig] != laatste_Joy) {
          reset();
          laatste_Joy = 0;
          break;
        } else {
          huidig++;
          laatste_Joy = 0:;
        }
      }
    }
  }
}

Where does your loop () function end?

At the end of the code.

Blueshirt97:
At the end of the code.

Then you have defined a function, reset() inside another function, loop(). It's not permitted.

Where should I put the function reset()?

Blueshirt97:
Where should I put the function reset()?

Anywhere outside of loop() or any other function.

By itself, after you close loop().