Please help I keep getting this error and can't figure it out:
//second ping
long duration, inches;
float feet;
pinMode(pingPin2,OUTPUT);
digitalWrite(pingPin2, LOW);
delayMicroseconds(2);
digitalWrite(pingPin2, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin2, LOW);
pinMode(pingPin2, INPUT);
duration = pulseIn(pingPin2, HIGH);inches = microsecondsToInches(duration);
feet = microsecondsToFeet(duration);Serial.print(inches);
Serial.print("in, ");
Serial.print(feet);
Serial.print("ft ");
Serial.println();delay(100);
// put what you want the servo to do based on how many inches away the object is...
if (inches <= 36)
{ servo.write(135);
}}
long microsecondsToInches(long microseconds)
{
return microseconds / 74 / 2;
}float microsecondsToFeet(long microseconds)
{
return microsecondsToInches(microseconds) / 12;
}