Test Code

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
m211482
Date:
Tue Apr 16 14:28:11 2019 +0000
Parent:
1:64d0588f103d
Commit message:
Hall Effect Final;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 64d0588f103d -r 4b534d899254 main.cpp
--- 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);
+    }
 }