for high school

Revision:
0:6dca851b4779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sensors.cpp	Sun Sep 09 13:44:05 2018 +0000
@@ -0,0 +1,29 @@
+#include "sensors.h"
+#include "mbed.h"
+
+//extern Serial usb;
+
+void sr501::triggered()
+{
+    //usb.printf("Triggered!\r\n");
+    status = true;
+}
+
+sr501::sr501(PinName pSignal)
+    : status(false), signal(pSignal)
+{
+    signal.rise(this, &sr501::triggered);
+}
+
+bool sr501::operator ==(const bool &target)
+{
+    if(status == target)
+        return true;
+    else
+        return false;
+}
+
+void sr501::reset()
+{
+    status = false;
+}