unsigned long pingRange (byte pingPin)
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin, LOW);
pinMode(pingPin, INPUT);
return pulseIn(pingPin, HIGH);
}
You can't declare functions inside other functions. You also need curly braces surrounding what code is to be part of the function.