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); //UART via ST-Link 00005 Mutex stdio_mutex; 00006 00007 void notify(const char* name, int state) 00008 { 00009 stdio_mutex.lock(); 00010 pc.printf("%s: %d\n\r", name, state); 00011 stdio_mutex.unlock(); 00012 } 00013 00014 void test_thread(void const *args) 00015 { 00016 while (true) { 00017 notify((const char*)args, 0); 00018 Thread::wait(1000); 00019 notify((const char*)args, 1); 00020 Thread::wait(1000); 00021 } 00022 } 00023 00024 int main() 00025 { 00026 pc.baud(115200); 00027 Thread t2(test_thread, (void *)"Th 2"); 00028 Thread t3(test_thread, (void *)"Th 3"); 00029 test_thread((void *)"Th 1"); 00030 }
Generated on Mon Aug 29 2022 19:54:57 by
1.7.2