lauren cloutier / cloutier_a7_modular_programming
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LM19.cpp Source File

LM19.cpp

00001 //.cpp file for temperature sensore, defines coefficients and functions 
00002 
00003 #include "LM19.h" //include .h file to take variables/functions from class
00004 
00005 LM19::LM19(PinName in1): _in1(in1) { //LM19 function is in class LM19, define pin
00006     //initialize coefficients- corresponds to temperature sensor data
00007     c1= -1481.96;
00008     c2= 2.1962*1000000.000;
00009     c3= 1.8636;
00010     c4= 3.88/1000000.000;
00011 } //close LM19
00012 
00013 float LM19::temp(){ //LM19 temperature computation function (double coulmn ::)
00014     float volt=_in1.read()*3.3; //read volt from defined pin,*3.3 to get volt from %
00015     float T=c1+sqrt(c2 + (c3-volt)/c4); //function to convert volt to temp. using coeff.
00016     return T; //returns value after function has been evaluated
00017 } //close float temp