Tempareture sensor driver edit Original maker zchen311

Dependents:   IoT_Weather_Station

Fork of TMP36 by ze chen

Revision:
1:ae41c2cdfd94
Parent:
0:ab3d7d0c34ce
--- a/TMP36.h	Tue Feb 12 06:23:02 2013 +0000
+++ b/TMP36.h	Tue Mar 08 14:16:59 2016 +0000
@@ -1,6 +1,3 @@
-#include "mbed.h"
- 
-//Setup a new class for TMP36 sensor
 class TMP36
 {
 public:
@@ -8,8 +5,9 @@
     TMP36();
     operator float ();
     float read();
+    float readFah();
 private:
-//class sets up the AnalogIn pin
+//sets up the AnalogIn pin
     AnalogIn _pin;
 };
  
@@ -23,6 +21,14 @@
 //convert sensor reading to temperature in degrees C
     return ((_pin.read()*3.3)-0.500)*100.0;
 }
+
+float TMP36::readFah()
+{
+    float tempC = ((_pin.read()*3.3)-0.500)*100.0;
+    return 9.0*(tempC)/5.0 + 32.0;
+        
+}
+
 //overload of float conversion (avoids needing to type .read() in equations)
 TMP36::operator float ()
 {