Test Code
Dependencies: mbed
Revision 2:4b534d899254, committed 2019-04-16
- 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); + } }