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.
Dependencies: mbed mbed-STM32F103C8T6 OneWireCRC_LoRa_Node SX1276Lib_LoRa_Node
Thermometer.cpp
- Committer:
- lukas_formanek
- Date:
- 2018-04-22
- Revision:
- 1:a54ff5e2c2f3
- Parent:
- 0:cc04364f049a
- Child:
- 4:a8853c148f2a
File content as of revision 1:a54ff5e2c2f3:
#include "Thermometer.h"
Thermometer::Thermometer(bool crcOn, bool useAddr, bool parasitic, PinName pin)
: thermometer(crcOn, useAddr, parasitic, pin)
{
meassuredValue = 0.0;
};
void Thermometer::Init()
{
thermometer.initialize();
thermometer.setResolution(THERMOMETER_RESOLUTION);
};
void Thermometer::StartPeriodicMeassure(float timeSec)
{
thermometerTicker.attach(callback(this,&Thermometer::OnSampleTick),timeSec);
};
void Thermometer::Meassure()
{
meassuredValue = thermometer.readTemperature();
while((rint(meassuredValue)) == 85) {
Init();
meassuredValue = thermometer.readTemperature();
}
rfm.SendValue(GATEWAY_ID, meassuredValue);
}
void Thermometer::OnSampleTick()
{
Meassure();
};