lm3531
Diff: LM35.cpp
- Revision:
- 0:b83c07e29cbb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LM35.cpp Sat Dec 03 11:43:42 2016 +0000 @@ -0,0 +1,29 @@ +#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); +} +