Very simple library for reading temperature from NTC thermistors
Dependents: lightweight-weather-station
Thermistor Class Reference
Measuring temperature with thermistor. More...
#include <thermistor.h>
Public Member Functions | |
Thermistor (PinName thermistorpin, int nominalres, int beta, int seriesresistor) | |
float | temperature () |
float | resistance () |
Detailed Description
Measuring temperature with thermistor.
Example of use:
#include "mbed.h" #include "thermistor.h" Serial pc(USBTX, USBRX); // serial communication int main() { Thermistor my_thermistor(A5, 10000, 3950, 4700); // instantiate the sensor object (on pin A5, nominal resistance is 10kOhms, beta coefficient is 3950 and value of the sacond resistor is 4,7kOhms while(1) { pc.printf("Temperature: %5.1f celsius degrees\r", my_thermistor.temperature()); pc.printf("Resistance: %5.1f ohms\r", my_thermistor.resistance()); wait_ms(1000); } }
Definition at line 20 of file thermistor.h.
Constructor & Destructor Documentation
Thermistor | ( | PinName | thermistorpin, |
int | nominalres, | ||
int | beta, | ||
int | seriesresistor | ||
) |
- Parameters:
-
thermistorpin mbed analog pin to which the thermistor is connected to nominalres resistance of thermistor at 25 celsius degrees beta beta coefficient of thermistor seriesresistor value of the resistor connecter with thermistor
Definition at line 4 of file thermistor.cpp.
Member Function Documentation
float resistance | ( | ) |
- Returns:
- resistance of thermistor
Definition at line 31 of file thermistor.cpp.
float temperature | ( | ) |
- Returns:
- temperature in celsius degrees
Definition at line 26 of file thermistor.cpp.
Generated on Sun Jul 17 2022 23:03:46 by 1.7.2