
Rohm BD7411g Omnipolar Detection Hall IC hello world.
Fork of mbed-os-example-mbed5-blinky by
main.cpp@12:18c2160813c6, 2016-09-19 (annotated)
- Committer:
- MikkoZ
- Date:
- Mon Sep 19 10:07:15 2016 +0000
- Revision:
- 12:18c2160813c6
- Parent:
- 8:bb09890333fe
Rohm BD7411g Omnipolar Detection Hall IC hello world initial version.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jonathan Austin |
0:2757d7abb7d9 | 1 | #include "mbed.h" |
Jonathan Austin |
0:2757d7abb7d9 | 2 | |
Jonathan Austin |
0:2757d7abb7d9 | 3 | DigitalOut led1(LED1); |
MikkoZ | 12:18c2160813c6 | 4 | //Edit input pin setup according to where hall sensor is connected |
MikkoZ | 12:18c2160813c6 | 5 | //(USER_BUTTON0 for button on GR-PEACH) |
MikkoZ | 12:18c2160813c6 | 6 | DigitalIn hall_sensor(USER_BUTTON0); |
MikkoZ | 12:18c2160813c6 | 7 | Serial pc(USBTX, USBRX); |
Jonathan Austin |
0:2757d7abb7d9 | 8 | |
Jonathan Austin |
1:846c97078558 | 9 | // main() runs in its own thread in the OS |
Jonathan Austin |
1:846c97078558 | 10 | // (note the calls to Thread::wait below for delays) |
Jonathan Austin |
0:2757d7abb7d9 | 11 | int main() { |
MikkoZ | 12:18c2160813c6 | 12 | pc.printf("\n\r"); |
MikkoZ | 12:18c2160813c6 | 13 | pc.printf("BD7411G Hall sensor example application.\r\n"); |
MikkoZ | 12:18c2160813c6 | 14 | pc.printf("Led on board will change ON/OFF according to magnet detection. \n\r"); |
MikkoZ | 12:18c2160813c6 | 15 | |
Jonathan Austin |
0:2757d7abb7d9 | 16 | while (true) { |
MikkoZ | 12:18c2160813c6 | 17 | led1 = hall_sensor; |
MikkoZ | 12:18c2160813c6 | 18 | Thread::wait(100); |
Jonathan Austin |
0:2757d7abb7d9 | 19 | } |
Jonathan Austin |
0:2757d7abb7d9 | 20 | } |
Jonathan Austin |
1:846c97078558 | 21 |