Voor jan

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
bjorntukkertje
Date:
Thu May 17 09:52:40 2018 +0000
Commit message:
Jan

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r a0d1e66e78aa main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 17 09:52:40 2018 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+
+class TMP36
+{
+public:
+    TMP36(PinName pin);
+    TMP36();
+    operator float ();
+    float read();
+private:
+    AnalogIn A0;
+};
+ 
+TMP36::TMP36(PinName pin) : A0(pin){}
+TMP36::operator float ()
+{
+    return ((A0.read()*3.3)-0.500)*100.0 + 1.2;
+}
+TMP36 myTMP36(A0);
+
+int main()
+{
+    float tempC;
+    float ta[10];
+    float temperatuur;
+
+    
+    while(1) {
+ 
+        tempC = myTMP36;
+        temperatuur = 0;
+        for (int i =0; i<10; i++)
+        {
+            ta[i] = float(myTMP36);
+            temperatuur += ta[i];
+        }
+        temperatuur /= 10;
+        printf(" T=%5.2F C \n\r", temperatuur);
+       
+        wait(1);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r a0d1e66e78aa mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 17 09:52:40 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5aab5a7997ee
\ No newline at end of file