reimlaer
reimlaer

Reputation: 11

not declared in this scope creating a loop

I am tying to make a loop that repeats itself for 100 seconds, but I keep on getting the same error and I am getting so frustrated that even if it is the most basic thing I will not notice, could someone please tell me what I am doing wrong? I would really appreciate, thanks.

void loop(void) {      
  for ( int i = 0; i <= 100; i++) {
    getFingerprintIDez();
    delay (50)            
  }
}

uint8_t getFingerprintID() {
  uint8_t attmpet = data.getImage();
  switch (attempt) {
    case FINGERPRINT_OK:
      break;
    case FINGERPRINT_NOFINGER:
      Serial.println("No fingerprint detected");
      return attempt;
    delay (500);
  }


  attempt = data.image2Tz();
  switch (attempt) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
      return attempt;      
  }

  attempt = data.fingerFastSearch();
  if (attempt == FINGERPRINT_OK) {
    Serial.println("Found a print match!");
  } else if (attmpt == FINGERPRINT_NOTFOUND) {
    Serial.println("Did not find a match");
    return attempt;
  } 
  Serial.print("Found ID #"); Serial.print(data.fingerID); 
  Serial.print(" with confidence of "); Serial.println(data.confidence); 

  return data.fingerID;
}

int getFingerprintIDez() {
  uint8_t attempt = data.getImage();
  if (attempt != FINGERPRINT_OK)  return -1;

  attempt = data.image2Tz();
  if (attempt != FINGERPRINT_OK)  return -1;

  attempt = data.fingerFastSearch();
  if (attempt != FINGERPRINT_OK)  return -1;

  Serial.print("Found ID #"); Serial.print(data.fingerID); 
  Serial.print(" with confidence of "); Serial.println(data.confidence);
  return data.fingerID; 
  delay (1000);
}

The message I keep getting is:

exit status 1 'getFingerprintIDez' was not declared in this scope

Thank you all

Upvotes: 1

Views: 923

Answers (2)

Juraj
Juraj

Reputation: 3736

  • missing ; after delay(50)
  • unused variable 'attmpet'
  • 'attmpt' was not declared in this scope

read the error messages from the first, not the last. the last error is only a consequence of the previous errors

Upvotes: 1

Caleb
Caleb

Reputation: 125007

In general, your indentation is a mess, and that's making it hard for you to see where the problem is. It looks to me like this line:

int getFingerprintIDez()

is a likely culprit for the error you're getting. I haven't counted braces, but I think your getFingerprintIDez() function might actually be defined inside the loop() function, and C doesn't allow that sort of thing.

So take care in formatting your code so that the various blocks are carefully indented the right amount -- C doesn't care about indentation, but it'll make it easier for you to see what blocks are inside what other blocks. Count open and close braces if you need to, and make sure that the definition of loop() ends before the definition of getFingerprintIDez() begins.

Upvotes: 2

Related Questions