lm3531

LM35.cpp

Committer:
arturogasca
Date:
2016-12-03
Revision:
0:b83c07e29cbb

File content as of revision 0:b83c07e29cbb:

#include "LM35.h"
 
LM35::LM35(PinName pin) :
    sensorPin(pin)
{
}
 
LM35::~LM35()
{
}
 
float LM35::get()
{
    avg=0;
    for(i=0;i<10;i++)
    {
        a[i]=sensorPin.read();
        wait(.02);
    }
    for(i=0;i<10;i++)
    {
        avg=avg+(a[i]/10);
    }

    tempC=(avg*3.685503686*100);
    
    return (tempC);
}