'getSalinitySensorPeriod' was not declared in this scope..how to solve that?
code: [select]
//constant won't change
const int salinitysensorpin = 2 ; //salinity sensor pin
//setup fucntion run @ beginning of program
void setup()
{
serial.begin(9600); //set data rate 9600 bps
pinmode (salinitysensorpin, input);
}
//repeating
void loop()
{
//cheack salinity period , calculate salinity frequency
float salinityperiod = getsalinitysensorperiod (); //assign return value
float salinityfrequancy= 1000 / salinityperiod ; // calculate frequency
//display period , frequency
serial.print("salinityperiod = ") ; //display salinity period
serial.print(salinityperiod); //display measured period
serial.println(" us"); //microsecond unit
serial.print("salinityfrequency = ");//display salinity frequency
serial.print (salinityfrequency,3);//display neasure frequency
serial.println(" khz");//unit heartz
//apply treadline convert percent salinity display salinity
float salinityvaluepercent = 0.01 * salinityfrequency + 0.05;//salinity percent
serial.print("salinity (before calibrated)= %";//salinity = '
serial.print(salinityvaluepercent,2);//display measured in percent mass
serial.println(" %");//display percent
delay(2000);// 1 second delay in read
}
//a function retrieving salinity sensor reading
//in period of microseconds
int getsalinitysensorperiod()
{
int timestart = 0 ;
int timestop = 0 ;
//wait pin go low
while( low ! = digitalread(salinitysensorpin)){}
//wait pin go high , reacord time
while (high ! = digitalread(salinitysensorpin){}
timestart = micros();
//wait pin go low second time
while (low ! = digitalread(salinitysensorpin)){}
//wait pin go high , record time
while(high ! = digitalread(salinitysensorpin)){}
timestop = micros();
//return in period diffrent between
return timestop - timestart;
}
getsalinitysensorperiod () != getsalinitysensorperiod()
Arduino Forum > Using Arduino > Programming Questions > 'getSalinitySensorPeriod' was not declared in this scope..how to solve that?
arduino
Comments
Post a Comment