All:
Started working my first non-tutorial project and the first step was getting my ping sensor running, which went off without a hitch. Broke things down into functions and keep getting the following error:
error: variable or field 'ping_Chirp' declared void In function 'void loop()':
At global scope:
I've looked things over again and again and can't figure it out. Searched various forums and haven't had much luck. My limited coding experience is from scripting a 3D modeling application (Rhino via VBscript) so I wouldn't be surprised if there's a syntax issue or similar simple thing I'm overlooking. Any feedback would be a huge help - thanks!
almost forgot:
Arduino Duemilanove (ATMEGA 328)
Arduino 0017
Mac OS X 10.5.7
#define pingPin = 7;
void setup() {
Serial.begin(9600);
}
void loop() {
long echo;
float cm;
ping_Chirp(pingPin);
echo = ping_Echo(pingPin);
cm = ping_Conversion(echo);
Serial.println(cm);
}
// chirp function to send signal
void ping_Chirp(pin) {
pinMode(pin, OUTPUT);
digitalWrite(pin, LOW);
delayMicroseconds(2);
digitalWrite(pin, HIGH);
delayMicroseconds(5);
digitalWrite(pin, LOW);
}
// echo function to retrieve value
long ping_Echo(pin) {
pinMode(pin, INPUT);
return pulseIn(pin, HIGH);
}
// conversion function to get actual measurement
float ping_Conversion(val) {
return val / 29 / 2;
}