Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Anemometer.cpp
- Committer:
- khaiminhvn
- Date:
- 2021-02-18
- Revision:
- 2:176046368412
- Parent:
- 0:306d17b459bd
- Child:
- 3:3e7f7afa0f94
File content as of revision 2:176046368412:
//INCLUDES
#include "Anemometer.h"
//Constructor
Anemometer::Anemometer() : ane(PIN_ANEMOMETER)
{
wthres = WIND_THRES_INIT;
}
//getWind
float Anemometer::getWind()
{
float spd;
spd = 72.9*ane*VCC-29.16;
return (spd < 0)? 0:spd;
}
//setThres
void Anemometer::setThres(int thres)
{
wthres = thres;
}
//checkWind
void Anemometer::checkWind(int* mode)
{
*mode = (Anemometer::getWind() >= wthres)? OP_WIND:OP_NORMAL;
}
//getRef
float Anemometer::getRef()
{
float tmp;
tmp = ane.get_reference_voltage();
return tmp;
}