Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "test_env.h"
00003 
00004 DigitalOut led(LED1);
00005 
00006 namespace {
00007     const int MS_INTERVALS = 1000;
00008 }
00009 
00010 void print_char(char c = '*')
00011 {
00012     printf("%c", c);
00013     fflush(stdout);
00014 }
00015 
00016 int main()
00017 {
00018     MBED_HOSTTEST_TIMEOUT(15);
00019     MBED_HOSTTEST_SELECT(wait_us_auto);
00020     MBED_HOSTTEST_DESCRIPTION(Time us);
00021     MBED_HOSTTEST_START("MBED_25");
00022 
00023     while (true) {
00024         for (int i = 0; i < MS_INTERVALS; i++) {
00025             wait_us(1000);
00026         }
00027         led = !led; // Blink
00028         print_char();
00029     }
00030 }