Etepam_Atividade_23_05_19

Dependencies:   mbed FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "stats_report.h"
00003 
00004 DigitalOut led1(LED1);
00005 
00006 #define SLEEP_TIME                  500 // (msec)
00007 #define PRINT_AFTER_N_LOOPS         20
00008 
00009 // main() runs in its own thread in the OS
00010 int main()
00011 {
00012     SystemReport sys_state( SLEEP_TIME * PRINT_AFTER_N_LOOPS /* Loop delay time in ms */);
00013 
00014     int count = 0;
00015     while (true) {
00016         // Blink LED and wait 0.5 seconds
00017         led1 = !led1;
00018         wait_ms(SLEEP_TIME);
00019 
00020         if ((0 == count) || (PRINT_AFTER_N_LOOPS == count)) {
00021             // Following the main thread wait, report on the current system status
00022             sys_state.report_state();
00023             count = 0;
00024         }
00025         ++count;
00026     }
00027 }