SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By manos437
#168691
Hello guys

When i read the wind speed with the weather meters i sometimes get some strange readings: (Gust is: 815.22)

The function is this:
Code: Select all
double getGust()
{
 
  unsigned long reading=anem_min;
  Serial.print("Anem_min: ");
  Serial.print(reading);
  anem_min=0xffffffff;
  Serial.print("        ");
  double time=reading/1000000.0;
  
  return (1/(reading/1000000.0))*WIND_FACTOR;
}
 
void anemometerClick()
{
  long thisTime=micros()-anem_last;
  anem_last=micros();
  //Deboucning interrupts that occurs within 500μs or 0.0005s since the last interrupt
  if(thisTime>500)
  {
    anem_count++;
    anem_count_2++;
    //Serial.println("Click");
    //Serial.println("");
    if(thisTime<anem_min)
    {
      anem_min=thisTime;
    }
 
  }
}
Image