Test Code

Dependencies:   mbed

Revision:
2:4b534d899254
Parent:
1:64d0588f103d
--- a/main.cpp	Tue Apr 16 14:14:30 2019 +0000
+++ b/main.cpp	Tue Apr 16 14:28:11 2019 +0000
@@ -8,15 +8,21 @@
 int i;
 int main()
 {
-        hall.mode(PullUp);
-        hallpwr=1;
+    hall.mode(PullUp);
+    hallpwr=1;
+    while (1) {
         i=hall.read();
         if (i==1) {
             printf("Magnet\n\r");
             myled=1;
+            hallpwr=0;
+            wait (0.5);
+            hallpwr=1;
         } else {
             printf("No magnet\n\r");
             myled=0;
         }
+        wait (0.2);
+    }
 }