x
Revision 1:b28f9b9a8962, committed 2021-01-27
- Comitter:
- percu
- Date:
- Wed Jan 27 23:07:24 2021 +0000
- Parent:
- 0:ab3d7d0c34ce
- Commit message:
- sd
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ABP.h Wed Jan 27 23:07:24 2021 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+
+//Setup a new class for TMP36 sensor
+class ABP
+{
+public:
+ ABP(PinName pin);
+ ABP();
+ operator float ();
+ float read();
+private:
+//class sets up the AnalogIn pin
+ AnalogIn _pin;
+};
+
+ABP::ABP(PinName pin) : _pin(pin)
+{
+// _pin(pin) means pass pin to the AnalogIn constructor
+}
+
+float ABP::read()
+{
+//convert sensor reading to temperature in degrees C
+ return (150*((_pin.read()*3300)-500)/4500)/14.5;
+}
+//overload of float conversion (avoids needing to type .read() in equations)
+ABP::operator float ()
+{
+//convert sensor reading to temperature in degrees C
+ return (150*((_pin.read()*3300)-500)/4500)/14.5;
+}
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LM35.h Wed Jan 27 23:07:24 2021 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+
+//Setup a new class for TMP36 sensor
+class LM35
+{
+public:
+ LM35(PinName pin);
+ LM35();
+ operator float ();
+ float read();
+private:
+//class sets up the AnalogIn pin
+ AnalogIn _pin;
+};
+
+LM35::LM35(PinName pin) : _pin(pin)
+{
+// _pin(pin) means pass pin to the AnalogIn constructor
+}
+
+float LM35::read()
+{
+//convert sensor reading to temperature in degrees C
+ return (_pin.read()*3.3)*100.0;
+}
+//overload of float conversion (avoids needing to type .read() in equations)
+LM35::operator float ()
+{
+//convert sensor reading to temperature in degrees C
+ return (_pin.read()*3.3)*100.0;
+}
+
\ No newline at end of file
--- a/TMP36.h Tue Feb 12 06:23:02 2013 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#include "mbed.h"
-
-//Setup a new class for TMP36 sensor
-class TMP36
-{
-public:
- TMP36(PinName pin);
- TMP36();
- operator float ();
- float read();
-private:
-//class sets up the AnalogIn pin
- AnalogIn _pin;
-};
-
-TMP36::TMP36(PinName pin) : _pin(pin)
-{
-// _pin(pin) means pass pin to the AnalogIn constructor
-}
-
-float TMP36::read()
-{
-//convert sensor reading to temperature in degrees C
- return ((_pin.read()*3.3)-0.500)*100.0;
-}
-//overload of float conversion (avoids needing to type .read() in equations)
-TMP36::operator float ()
-{
-//convert sensor reading to temperature in degrees C
- return ((_pin.read()*3.3)-0.500)*100.0;
-}
-
\ No newline at end of file