Temperature library for the full project.
Temp_Sensor.cpp
- Committer:
- ptcrews
- Date:
- 2015-12-07
- Revision:
- 1:fc58ae197a88
- Parent:
- 0:a42f4353261f
File content as of revision 1:fc58ae197a88:
#include "Temp_Sensor.h" /* 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 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! }