Antonia Baumgartner / Mbed 2 deprecated Versuch21

Dependencies:   mbed

Fork of Versuch20 by Alexander Wyss

Revision:
0:b886f13e4ac6
Child:
2:efa9a78591da
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Classes/IRSensorK.cpp	Sun Apr 22 16:14:54 2018 +0000
@@ -0,0 +1,27 @@
+#include <cmath>
+#include "IRSensorK.h"
+
+using namespace std;
+
+    IRSensorK::IRSensorK(AnalogIn& distance):
+    
+        distance(distance) {
+            
+    
+    }
+
+    IRSensorK::~IRSensorK() {}
+    
+    int IRSensorK::read() {
+        int d;
+
+    if (3300*(distance)> 400) { //3cm+
+        d=1;
+        }
+    else {
+        d=0;
+        }
+    
+    return d;
+    
+    }
\ No newline at end of file