Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os-example-mbed5-blinky by
Diff: main.cpp
- Revision:
- 12:18c2160813c6
- Parent:
- 8:bb09890333fe
diff -r 0fa38cb22ea9 -r 18c2160813c6 main.cpp
--- a/main.cpp Fri Sep 02 15:15:05 2016 +0100
+++ b/main.cpp Mon Sep 19 10:07:15 2016 +0000
@@ -1,13 +1,21 @@
#include "mbed.h"
DigitalOut led1(LED1);
+//Edit input pin setup according to where hall sensor is connected
+//(USER_BUTTON0 for button on GR-PEACH)
+DigitalIn hall_sensor(USER_BUTTON0);
+Serial pc(USBTX, USBRX);
// main() runs in its own thread in the OS
// (note the calls to Thread::wait below for delays)
int main() {
+ pc.printf("\n\r");
+ pc.printf("BD7411G Hall sensor example application.\r\n");
+ pc.printf("Led on board will change ON/OFF according to magnet detection. \n\r");
+
while (true) {
- led1 = !led1;
- Thread::wait(500);
+ led1 = hall_sensor;
+ Thread::wait(100);
}
}

Rohm BD7411G | Magnet Hall IC