Scope error

Whenever I run the code I get an error saying ‘mircosecondsToCentimeters’ was not declared in this scope

please help me

const int TriggerPin = 2;//CHEST
const int EchoPin = 5;

const int TriggerPin2 = 3;//HIP
const int EchoPin2 = 6;

const int TriggerPin3 = 4;//FOOT
const int EchoPin3 = 7; 

const int analogInputPin = 5;//CHEST
const int analogInputPin2 = 6;//HIP
const int analogInputPin3 = 7;//FOOT

#include <SPI.h>
#include <Andee.h>

  AndeeHelper analogDisplay; //display info
  AndeeHelper analogDisplay2;
  AndeeHelper analogDisplay3; 
  AndeeHelper sensor1; // display boxes
  AndeeHelper sensor2;
  AndeeHelper sensor3;
  AndeeHelper sendMessage; // send sms
  AndeeHelper SMSobject; // send sms
  AndeeHelper displaybox;// ????
  AndeeHelper button; // ???
  AndeeHelper speechObject; // phone to talk

 
  char messageRecipent [] = "+7329103772"; // sms
  char message [] = "OBJECT DETECTED"; // sms
  void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  Andee.begin();
  Andee.clear();
  setInitialData();
}
void setInitialData()
{
  sendMessage.setId(0);          //sms
  sendMessage.setType(BUTTON_IN);
  sendMessage.setLocation(0,0,FULL);
  sendMessage.setTitle("Send SMS");

  SMSobject.setId(1);     //sms
  SMSobject.setType(SMS_SENDER);
  SMSobject.setRecipient(messageRecipent);
  SMSobject.setMessage(message);

  displaybox.setId(0);   //text to speech
  displaybox.setType(DATA_OUT);
  displaybox.setTitle("Text to Speech");
  displaybox.setData("Be sure to unmute your phone to hear your phone talk!");  //create a message for the phone
  

  sensor1.setId(0); // create boxes on display
  sensor1.setType(DATA_OUT);
  sensor1.setLocation(0, 0, FULL);
  sensor1.setTitle("Ultrasonic Sensor");
  sensor1.setData("Data For Sensor");
  sensor1.setUnit("Unit Field for Data");

  sensor2.setId(0);
  sensor2.setType(DATA_OUT);
  sensor2.setLocation(0, 0, FULL);
  sensor2.setTitle("");// insert text
  sensor2.setData("");//insert text
  sensor2.setUnit("");//insert text
  
  sensor3.setId(0);
  sensor3.setType(DATA_OUT);
  sensor3.setLocation(0, 0, FULL);
  sensor3.setTitle("");// insert text
  sensor3.setData("");//insert text
  sensor3.setUnit("");//insert text
  

  analogDisplay.setId(0);  //display inputted data
  analogDisplay.setType(DATA_OUT);
  analogDisplay.setLocation(0, 0, FULL);
  analogDisplay.setTitle("Ultrasonic Sensor information");
  analogDisplay.setData(""); // must be updataed with the new analog data
  
  analogDisplay2.setId(0);  //display inputted data
  analogDisplay2.setType(DATA_OUT);
  analogDisplay2.setLocation(0, 0, FULL);
  analogDisplay2.setTitle("Ultrasonic Sensor information");
  analogDisplay2.setData(""); // must be updataed with the new analog data

  analogDisplay3.setId(0);  //display inputted data
  analogDisplay3.setType(DATA_OUT);
  analogDisplay3.setLocation(0, 0, FULL);
  analogDisplay3.setTitle("Ultrasonic Sensor information");
  analogDisplay3.setData(""); // must be updataed with the new analog data

}

void loop() {
  long duration, cm;
  long duration2, cm2;
  long duration3, cm3;
  pinMode(TriggerPin, OUTPUT);
  digitalWrite(TriggerPin, LOW); // youve got to set it to low not high, everything in electronics starts out in the off position
  delayMicroseconds(2); // time taken for configuration to transition from off to on
  digitalWrite(TriggerPin, HIGH); // since voltage is flowing through now that youve turned it on, you set your trigpin to high
  delayMicroseconds(10); // just to smooth out voltage a bit
  digitalWrite(TriggerPin, LOW); // set it back to low

  
  
  pinMode(EchoPin, INPUT); // good job identifying here the type (input/output), good start!
  duration = pulseIn(EchoPin, HIGH); // you didnt do anything with the duration variable you declared, youve got to set it to pulseIn due
                                     // to the fact that sonar sensors recieve echos through pulseWidth modulation.

 


  pinMode(TriggerPin2, OUTPUT);
  digitalWrite(TriggerPin2, LOW); // youve got to set it to low not high, everything in electronics starts out in the off position
  delayMicroseconds(2); // time taken for configuration to transition from off to on
  digitalWrite(TriggerPin2, HIGH); // since voltage is flowing through now that youve turned it on, you set your trigpin to high
  delayMicroseconds(10); // just to smooth out voltage a bit
  digitalWrite(TriggerPin2, LOW); // set it back to low

  
  
  pinMode(EchoPin2, INPUT); // good job identifying here the type (input/output), good start!
  duration2 = pulseIn(EchoPin2, HIGH); // you didnt do anything with the duration variable you declared, youve got to set it to pulseIn due
                                     // to the fact that sonar sensors recieve echos through pulseWidth modulation.



  pinMode(TriggerPin3, OUTPUT);
  digitalWrite(TriggerPin3, LOW); // youve got to set it to low not high, everything in electronics starts out in the off position
  delayMicroseconds(2); // time taken for configuration to transition from off to on
  digitalWrite(TriggerPin3, HIGH); // since voltage is flowing through now that youve turned it on, you set your trigpin to high
  delayMicroseconds(10); // just to smooth out voltage a bit
  digitalWrite(TriggerPin3, LOW); // set it back to low

  
  
  pinMode(EchoPin3, INPUT); // good job identifying here the type (input/output), good start!
  duration3 = pulseIn(EchoPin3, HIGH); // you didnt do anything with the duration variable you declared, youve got to set it to pulseIn due
                                     // to the fact that sonar sensors recieve echos through pulseWidth modulation.



  cm = microsecondsToCentimeters(duration);
  
  
  

  Serial.print(cm);
  Serial.print(" CM AWAY FROM CHEST  ");
  Serial.print(cm2);
  Serial.print("    CM AWAY FROM HIP");
  Serial.println();
  
  delay(100);

  sensor1.update();
  int reading = analogRead(analogInputPin); // any pins in analoginput pin 4??, dont see any
  analogDisplay.setData(reading);
  analogDisplay.update();

  sensor2.update();
  int reading = analogRead(analogInputPin2);
  analogDisplay2.setData(reading);
  analogDisplay2.update();

  sensor3.update();
  int reading = analogRead(analogInputPin3);
  analogDisplay3.setData(reading);
  analogDisplay3.update();
  
  float distance,distance2;
  distance = cm;
  distance2 = cm2;
  distance3 = cm3;

  if(distance <= 30)
  {
  SMSobject.send("chest level"); // inser text word
  Serial.print("");//insert saying
  speechObject.updateData("");// insert saying
  
  }
  }
  if(distance2 <= 30)
  {
  SMSobject.send("hip level"); // inser text word
  Serial.print("");//insert saying
  speechObject.updateData("");// insert saying
  }
  
  if(distance3 <= 30)
  {
  SMSobject.send("foot level");
   Serial.print("Object Detected = ");
   speechObject.updateData("Confucius say: Man run in front of car get tired,"); 
   speechObject.updateData("man run behind car get exhausted."); 
  if(distance && distance2 <= 30)
  {
    SMSobject.send("hip level"); // inser text word
  Serial.print("");//insert saying
  speechObject.updateData("");// insert saying
  
    }
  if(distance && distance2 <=30)
  {
    SMSobject.send("upper level"); // inser text word
  Serial.print("");//insert saying
  speechObject.updateData("");// insert saying
  }
  if(distance2 && distance3 <= 30){
    SMSobject.send("lower levels"); // inser text word
  Serial.print("");//insert saying
  speechObject.updateData("");// insert saying
  }
  if(distance && distance 2 && distance 3 <= 30)
  {
SMSobject.send("all levels"); // inser text word
  Serial.print("");//insert saying
  speechObject.updateData("");// insert saying
  
  }
  }
  
  displaybox.update();
  sendMessage.update();
  delay(500); //DO NOT DELETE!
  
}

long microsecondsToCentimeters(long microseconds) {
 
  return microseconds / 29 / 2; 
  
  delay(2000);

  }

Where does the loop() function end ?

Auto Formatting the code might help.

Well, it is there with a slightly different spelling to your quoted error message

long microsecondsToCentimeters(long microseconds) {

  return microseconds / 29 / 2;

  delay(2000);

}

but there are a few too many '}' before it.

If you follow the advice above and format it (tools-->autoformat), it should become obviuos from the indentation where the error is.

I don't know how to

the loop ends right before the microseconds line

cpatriot12:
I don’t know how to

the loop ends right before the microseconds line

In your code the loop() function ends here

  }
}  //end of loop() function
if (distance2 <= 30)

Use Tools/Auto Format in the IDE