Rohm / Mbed OS rohm-bd7411g-hello

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 DigitalOut led1(LED1);
00004 //Edit input pin setup according to where hall sensor is connected
00005 //(USER_BUTTON0 for button on GR-PEACH)
00006 DigitalIn hall_sensor(USER_BUTTON0);
00007 Serial pc(USBTX, USBRX);
00008 
00009 // main() runs in its own thread in the OS
00010 // (note the calls to Thread::wait below for delays)
00011 int main() {
00012     pc.printf("\n\r");
00013     pc.printf("BD7411G Hall sensor example application.\r\n");
00014     pc.printf("Led on board will change ON/OFF according to magnet detection. \n\r");
00015 
00016     while (true) {
00017         led1 = hall_sensor;
00018         Thread::wait(100);
00019     }
00020 }
00021