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 #include "mbed.h" 00002 #include "rtos.h" 00003 00004 unsigned int delayms = 1000; 00005 00006 void print_char(char c = '*') 00007 { 00008 printf("%c", c); 00009 fflush(stdout); 00010 } 00011 00012 DigitalOut led1(LED1); 00013 00014 void print_thread(void const *argument) 00015 { 00016 while (true) { 00017 Thread::wait(delayms); 00018 led1 = !led1; 00019 } 00020 } 00021 00022 void read_keyboard(void const *argument) 00023 { 00024 char c; 00025 while (true) { 00026 00027 c = getchar(); 00028 printf("\t%X\n", c); 00029 } 00030 } 00031 00032 00033 int main() 00034 { 00035 printf("\n\n*** RTOS basic example ***\n"); 00036 Thread t1(print_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); 00037 Thread t2(read_keyboard); 00038 00039 //Sleep the main thread 00040 Thread::wait(osWaitForever); 00041 }
Generated on Wed Jul 20 2022 12:00:50 by
1.7.2