TVZ2020 / LM35

Fork of LM35 by Lukas Buha

Files at this revision

API Documentation at this revision

Comitter:
lbuha
Date:
Mon Feb 22 01:53:52 2021 +0000
Commit message:
.

Changed in this revision

LM35.cpp Show annotated file Show diff for this revision Revisions of this file
LM35.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 0604431a65be LM35.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LM35.cpp	Mon Feb 22 01:53:52 2021 +0000
@@ -0,0 +1,19 @@
+#include "LM35.h"
+#include "mbed.h"
+
+LM35::LM35(PinName pin) : _pin(pin) {}
+    
+float temperatura;
+ 
+float LM35::mjerenje()
+{
+    
+     Serial pc(USBTX, USBRX);
+     temperatura = _pin.read();
+     temperatura = (temperatura)*500;
+    
+    pc.printf("Temperatura je %f stupnjeva Celzijevih.\n \n \r", temperatura); //ispis temperature na računalo
+    
+    return temperatura;
+    
+}
\ No newline at end of file
diff -r 000000000000 -r 0604431a65be LM35.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LM35.h	Mon Feb 22 01:53:52 2021 +0000
@@ -0,0 +1,15 @@
+#ifndef MBED_LM35
+#define MBED_LM35
+#include "mbed.h"
+class LM35
+{
+public:
+    LM35(PinName pin);
+    float mjerenje();
+    
+private:
+    AnalogIn _pin;
+
+};
+
+#endif
\ No newline at end of file