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.
main.cpp
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2018 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 */ 00005 00006 #include "mbed.h" 00007 #include "ThisThread.h" 00008 #include "stats_report.h" 00009 00010 DigitalOut led1(LED1); 00011 00012 #define SLEEP_TIME 500 // (msec) 00013 #define PRINT_AFTER_N_LOOPS 20 00014 00015 // main() runs in its own thread in the OS 00016 int main() 00017 { 00018 SystemReport sys_state( SLEEP_TIME * PRINT_AFTER_N_LOOPS /* Loop delay time in ms */); 00019 00020 int count = 0; 00021 while (true) { 00022 // Blink LED and wait 0.5 seconds 00023 led1 = !led1; 00024 ThisThread::sleep_for(SLEEP_TIME); 00025 00026 if ((0 == count) || (PRINT_AFTER_N_LOOPS == count)) { 00027 // Following the main thread wait, report on the current system status 00028 sys_state.report_state(); 00029 count = 0; 00030 } 00031 ++count; 00032 } 00033 }
Generated on Sat Jul 23 2022 07:52:22 by
1.7.2