Temperature library for the full project.
Diff: Temp_Sensor.cpp
- Revision:
- 0:a42f4353261f
- Child:
- 1:fc58ae197a88
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Temp_Sensor.cpp Sat Dec 05 07:31:46 2015 +0000 @@ -0,0 +1,12 @@ +#include "Temp_Sensor.h" + +//function to get both the +// Using the AD22100K temperature sensor +float Temp_Sensor::read() { + // Convert Analog-input value to temperature + //1023 is to scale it up to the arduino read values. + float voltage = (int)((temperature.read() * ADC_CONVERSION) * 1023); + float temperatureValue = (voltage * 0.217226044) - 61.1111111; // conversion factor simplified. + printf("AI_Val: %f\n", temperatureValue); + return temperatureValue; // 22.5 mV / °C; Ratiometric measurement, conversion valid for 5 V! +} \ No newline at end of file