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 Serial pc(USBTX, USBRX); 00005 DigitalOut myled(LED4); 00006 Queue<uint32_t, 5> queue; 00007 00008 00009 void console_out(void const *args) 00010 { 00011 printf(">led thread start\r\n"); 00012 int f = 1; 00013 while(f) { 00014 myled = 1; 00015 Thread::wait(500); 00016 myled = 0; 00017 Thread::wait(500); 00018 osEvent evt = queue.get(100); 00019 if(evt.status != osEventMessage) { 00020 printf(">returned %02x status\r\n", evt.status); 00021 } else { 00022 printf(">returned %d\r\n", evt.value.v); 00023 if(evt.value.v == 1) f = 0; 00024 } 00025 } 00026 printf(">led thread end.\r\n"); 00027 } 00028 00029 int main(void) 00030 { 00031 pc.baud(921600); 00032 printf("\r\n==== mbed program start ====\r\n"); 00033 printf("%s\r\n", __FILE__); 00034 Thread th_console_out(console_out); 00035 wait(10); 00036 queue.put((uint32_t*)1); 00037 wait(10); 00038 printf("=== mbed program end ====\r\n"); 00039 exit(1); 00040 }
Generated on Thu Jul 14 2022 19:16:43 by
1.7.2