Demo application of reading 6 different sensors and outputting values on UART. This demo can be used with Rohm tileshield using tiles for BH1726, BD1020, RPR0521, BH1745, ML8511 and BD7411. Developed and tested using Renesas GR-Peach -board.
Dependencies: rohm-bh1726 rohm-bh1745 rohm-rpr0521 rohm-sensor-hal
Fork of rohm-bd7411g-hello 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
- Child:
- 13:69b1b8cadb78
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 |
