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 00003 Thread SHOW_THREAD;//声明一个线程 00004 Serial ST_LINK_UART(SERIAL_TX, SERIAL_RX);//声明一个调试串口 00005 //------------------------------------ 00006 // Hyperterminal configuration 00007 // 9600 bauds, 8-bit data, no parity 00008 //------------------------------------ 00009 00010 void show_thread_func(void) 00011 { 00012 ST_LINK_UART.printf("One_Min_Time_Up\n"); 00013 fflush(stdout); 00014 } 00015 00016 DigitalOut USER_LED(PA_5); 00017 00018 void print_thread()//线程函数 00019 { 00020 while (true) 00021 { 00022 wait(60);//线程等待调用时长 00023 show_thread_func();//执行操作如打印字符,后进入标准线程 00024 } 00025 } 00026 00027 int main() 00028 { 00029 ST_LINK_UART.baud(115200);//重定义波特率为115200 00030 ST_LINK_UART.printf("RTOS_basic_example\n"); 00031 SHOW_THREAD.start(print_thread);//启动一个演示线程,此处演示线程操作是打印字符* 00032 while (true) 00033 { 00034 USER_LED = !USER_LED; 00035 wait(0.5); 00036 } 00037 }
Generated on Tue Jul 12 2022 12:44:58 by
