Temperature library for the full project.
Diff: Temp_Sensor.cpp
- Revision:
- 1:fc58ae197a88
- Parent:
- 0:a42f4353261f
--- a/Temp_Sensor.cpp Sat Dec 05 07:31:46 2015 +0000 +++ b/Temp_Sensor.cpp Mon Dec 07 00:06:03 2015 +0000 @@ -1,11 +1,13 @@ #include "Temp_Sensor.h" -//function to get both the -// Using the AD22100K temperature sensor +/* Function: read + * --------------- + * Reads the temperature from the AD22100K sensor. + */ float Temp_Sensor::read() { // Convert Analog-input value to temperature + float voltage = (int)((temperature.read() * ADC_CONVERSION) * 1023); //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!