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.
Fork of analoghalls5 by
tempsensors.cpp
00001 #include "includes.h" 00002 #include "sensors.h" 00003 00004 NtcTempSensor::NtcTempSensor(PinName pin, float r_25, float ntc_b, float r_divider) { 00005 _in = new AnalogIn(pin); 00006 _ntc_b = ntc_b; 00007 _ntc_a = r_25 / exp(_ntc_b / 298.0f); 00008 _r_divider = r_divider; 00009 } 00010 00011 float NtcTempSensor::GetTemp() { 00012 float v = (float) *_in * 3.3f; 00013 float r_n = v * _r_divider / (1.0f + v); 00014 return _ntc_b / log (r_n / _ntc_a); 00015 }
Generated on Fri Jul 15 2022 12:15:05 by
1.7.2
