I'm trying to implement a Sparkfun weather station using an mDot with UDK dev board.
The code below is part of some example code gotten from the mbed resources.
I do not believe the ISR - timer scheme is actually running (a temporary printf in it never produces output). Can someone point to a step I may be missing?
/* Copyright 2012 Adam Green (http://mbed.org/users/AdamGreen/)
...
Implementation of class to interface for anemometer sensor with Sparkfun Weather Meters:
http://www.sparkfun.com/products/8942
*/
#include <mbed.h>
#include "Anemometer.h"
#define REV_PER_SECOND_TO_KMPH 2.4f
CAnemometer::CAnemometer(PinName AnemometerPin, unsigned int IgnoreTimeForDebounceInMicroSeconds)
: CDebouncedFallingEdgeCounter(AnemometerPin, IgnoreTimeForDebounceInMicroSeconds)
{
m_CurrentWindSpeed = 0.0f;
ResetMaximumWindSpeed();
m_OneSecondTicker.attach_us<CAnemometer>(this, &CAnemometer::OneSecondTickerISR, 1000000);
}
...
void CAnemometer::OneSecondTickerISR()
{
unsigned int GetCurrentCount = GetCountAndZero();
m_CurrentWindSpeed = (float)GetCurrentCount * REV_PER_SECOND_TO_KMPH;
if (m_CurrentWindSpeed > m_MaximumWindSpeed)
{
m_MaximumWindSpeed = m_CurrentWindSpeed;
}
}
My main.cpp has this line
CWeatherMeters weathermeters( WINDSPEED_PIN, RAIN_GAUGE_PIN, WINDDIR_PIN );
and the file weathermeters.cpp has
CWeatherMeters::CWeatherMeters(PinName AnemometerPin,
PinName RainGaugePin,
PinName WindVanePin,
float WindVaneSeriesResistance) : m_Anemometer(AnemometerPin),
m_RainGauge(RainGaugePin),
m_WindVane(WindVanePin, WindVaneSeriesResistance)
{
}
I'm trying to implement a Sparkfun weather station using an mDot with UDK dev board.
The code below is part of some example code gotten from the mbed resources.
I do not believe the ISR - timer scheme is actually running (a temporary printf in it never produces output). Can someone point to a step I may be missing?
/* Copyright 2012 Adam Green (http://mbed.org/users/AdamGreen/) ... Implementation of class to interface for anemometer sensor with Sparkfun Weather Meters: http://www.sparkfun.com/products/8942 */ #include <mbed.h> #include "Anemometer.h" #define REV_PER_SECOND_TO_KMPH 2.4f CAnemometer::CAnemometer(PinName AnemometerPin, unsigned int IgnoreTimeForDebounceInMicroSeconds) : CDebouncedFallingEdgeCounter(AnemometerPin, IgnoreTimeForDebounceInMicroSeconds) { m_CurrentWindSpeed = 0.0f; ResetMaximumWindSpeed(); m_OneSecondTicker.attach_us<CAnemometer>(this, &CAnemometer::OneSecondTickerISR, 1000000); } ... void CAnemometer::OneSecondTickerISR() { unsigned int GetCurrentCount = GetCountAndZero(); m_CurrentWindSpeed = (float)GetCurrentCount * REV_PER_SECOND_TO_KMPH; if (m_CurrentWindSpeed > m_MaximumWindSpeed) { m_MaximumWindSpeed = m_CurrentWindSpeed; } }My main.cpp has this line
and the file weathermeters.cpp has
CWeatherMeters::CWeatherMeters(PinName AnemometerPin, PinName RainGaugePin, PinName WindVanePin, float WindVaneSeriesResistance) : m_Anemometer(AnemometerPin), m_RainGauge(RainGaugePin), m_WindVane(WindVanePin, WindVaneSeriesResistance) { }