Sparkfun Weather Meter Kit

Hi Jan

I only find the below code for the weather station that I have , will it work with MBED6 ?

Regards

Hello again,

great, you found something.

Line 29 of WheaterMeters.h

// from this
class WeatherMeters : public Base {
// to this because I do not know where the base class can be and I don't see any relation with it
class WeatherMeters{

Lines 43-45 of WheaterMeters.cpp

// from this
    int01.fall(this, &WeatherMeters::int_anemometer);
    int02.fall(this, &WeatherMeters::int_raingauge);
    ticker01.attach(this, &WeatherMeters::int_timer, 0.25); 
// to this
    int01.fall(callback(this,&WeatherMeters::int_anemometer));
    int02.fall(callback(this,&WeatherMeters::int_raingauge));
    ticker01.attach(callback(this,&WeatherMeters::int_timer), 250ms); 

However this library is only for Anemometer, Wind vane, Rain gauge. For rest sensors you will need another libraries.

BR, Jan

Thanks i will just add the pin numbers and hopefully it will work

Regards

Hi

So do i need to add pins to the code as i dont see any pins allocated and i see no printf function to display the values .

Thanking You

Hi

I tried to load the code , but I seem to get the error red lines below on Mbed studio 6

Regards

Please be so kind, scroll up and look my last post.
BTW it is not Mbed Studio 6. Mbed Studio is 1.4.3 and MbedOS is 6+ (6.15.1 is latest)

BR, Jan

Hi

I tried to compile my code but I get an error ? Am i maybe in an incorrect directory as I did try to create a new project .

Hi there,

try change from Release profile to Debug profile.
Also take a look to windows Output and Problems - View->Output / View->Problems

BR, Jan

Good Day

I tried to change to debug mode but am getting the same error;

Regards

Good day also for you,

nope that is not same errors. About those errors I already told you two times above, so be so kind and change the content of the library according to instructions

BR, Jan

Hi Sir

It has been changed please see below , I have attached the code and library .

Link to library ;

https://os.mbed.com/users/okini3939/code/WeatherMeters/

main.cpp

Weathermeters.h :

Regards

(Attachment main.cpp is missing)

(Attachment WeatherMeters.h is missing)

Ok, but how you can see compiler does not see that…
So you have selected another project with same content. If not try to run Clean Build ( under the arrow close to the hammer button).

BTW that not seem to be right, It seems like have it twice in project (one with gear is OK)

BR, Jan

Ok I deleted the 1 it was a duplicate , it looking better now , just giving error after 100% compile

Thanks for the assistance

Regards

Good Afternoon

When i try to compile under debug mode after compiling 100% I get the below error , code seems fine

Regards

Hi there,

You still have a chaos in your project I think.
According to first picture you have content of WeatherMeters.cpp inside of main.cpp

BR, Jan

Good Evening

I had a look and the folder seems fine as I have deleted the previous “project within a project” I still cant complie though

I also have a 2nd Question I am using a Nucleo F446RE MCU , dont I need to assign ports as I dont see any ports assigned in the code

Thanking You

This is the current files in the folder which seems correct

Print Screen of first few lines tells me nothing.
From my point of view, the WeatherMeters.cpp file is missing in your project and the main.cpp file must contain content like below (only example, nothing real)

#include "mbed.h"
#include "WeatherMeters.h"

WeatherMeters station(A0, A1, A2, Weather_auto); // I do not know your pins so I use fake pins
// rest of globals

int main() {
    printf("Mbed WeatherMeters example\r\n");
    // do something before loop
    while(1){
       // do something in loop
    }
}

I suppose you do not have int main() in your main.cpp and that is the reason why your project can not be compiled.

BR, Jan

So looks like the code example is incorrect and there is no other sample code for the sparkfun weather meter kit for MBED .As i tried looking online

What example? I do not see any example

You linked only the library - WeatherMeters - Weather Meters (Sparkfun) http://mbed.org/users/… | Mbed
So you need to import it to your project again and then use it in your main.cpp with your own usage.

According to - Wetterstation - Dieses Programm verarbeitet die einzelnen Messwer… | Mbed you probably need something like this.

#include "mbed.h"
#include "WeatherMeters.h"

WeatherMeters station(A0, A1, A2, Weather_auto); // change to your pins

int main() {
    printf("Mbed WeatherMeters example\r\n");
    // do something before loop
    while(1){
        printf("Windspeed: %3.2f\r\n",station.get_windspeed());
        printf("Windvane: %3.2f °\r\n",station.get_windvane());
        printf("Raingaug %3.2f\r\n",station.get_raingauge());
        thread_sleep_for(1000);
    }
}

Sorry, but it seems like you not understand basics.

BR, Jan