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-03-12
- Revision:
- 3:3e7f7afa0f94
- Parent:
- 2:176046368412
- Child:
- 4:5a2e51b243e0
File content as of revision 3:3e7f7afa0f94:
//INCLUDES
#include "Anemometer.h"
//Constructor
Anemometer::Anemometer() : ane(PIN_ANEMOMETER)
{
wthres = WIND_THRES_INIT;
}
//getWind
float Anemometer::getWind(int* flag)
{
float spd;
spd = 72.9*ane*VCC-29.16;
*flag = 1;
return (spd < 0)? 0:spd;
}
//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;
}