Sparkfun Anemometer sensor reading

Hi

I want to read the wind speed from my sparkfun wind speed sensor the sensor only read’s wind speed greater than 2,4km/h . Please advise on the error that I might have done as I am struggling to compile on MBED OS :

#include “mbed.h”

DigitalIn Anemometer(PB_10); // Digital in API for Digital Anemometer
Ticker Anemometer_Interrupt; //Ticker API intrrupt to create interrupt at set interval time
int Anemometer_din_current = 0, Anemometer_din_old = 0; //Digital input is read as interger value - create variable to store and process the Anenometer integer value
float Anemometer_Speed = 2400;

void Anemometer_Interrupt_handler(){ //create the code that will run when the Ticker API interrupt the CPU at the set interval
Anemometer_din_current = Anemometer; //Read the Anemometer Digital input and store its value in the variable
if(Anemometer_din_current!=Anemometer_din_old) //Check to see if the Anemometer integer value is different from previous the stored value
float get_windspeed() {
float s;
Anemometer_din_old speed = 2400; // Local Variable value
speed *= Anemometer_Speed;
speed /= 1000 ; // To give value in km/h
Anemometer_Speed = 0 ;
}
}

int main (){

      Anemometer_Interrupt.attach(&Anemometer_Interrupt_handler,2000ms); //Ticker interrupt initialised to interrupt the CPU every 2 seconds

    

while(true) { 
printf("Windspeed: %3.2d\r\n",Anemometer_din_current); //Displays interger value read from Anemometer Digital input
    ThisThread::sleep_for(500ms);   //Put the main task into a 500 ms sleep - it does not get executed fro 500ms.
    }

}

Hello again,

void Anemometer_Interrupt_handler(){ //create the code that will run when the Ticker API interrupt the CPU at the set interval
Anemometer_din_current = Anemometer; //Read the Anemometer Digital input and store its value in the variable
if(Anemometer_din_current!=Anemometer_din_old) //Check to see if the Anemometer integer value is different from previous the stored value
float get_windspeed() {
float s;
Anemometer_din_old speed = 2400; // Local Variable value
speed *= Anemometer_Speed;
speed /= 1000 ; // To give value in km/h
Anemometer_Speed = 0 ;
}
}

This not seems to be a valid function, it looks like a mess, one function in another incomplete function.

BR, Jan

So how should it look please advise whom can assist ?

thanks

I do not know your source of this. From my point of view you are trying for a code like is in this library - WeatherMeters - Weather Meters (Sparkfun) http://mbed.org/users/… | Mbed

However, we already discussed about it

BR, Jan

Good evening

I am trying to create my own code with own library to read the anemometer as the sample code is incorrect in the link .

Regards

Sorry, but why do you think that? How I said many times before not working / is incorrect is no reason, there must be a real reason for that.

You are using this sparkfun shield right?
So try this - Sparkfun_Weather_Meter - Sparkfun’s Weather Meter demo | Mbed

BR, Jan