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 DigitalOut led1(P0_29); 00005 DigitalOut led2(P0_9); 00006 Serial pc(USBTX, USBRX); // tx, rx 00007 00008 int a=0,b=0; 00009 void led1_thread(void const *argument) { 00010 while (true) { 00011 led1 = !led1; 00012 Thread::wait(500); 00013 } 00014 } 00015 00016 void led2_thread(void const *argument) { 00017 while (true) { 00018 led2 = !led2; 00019 a = a + 1; 00020 Thread::wait(250); 00021 } 00022 } 00023 00024 void print_thread(void const *argument) { 00025 while (true) { 00026 b = b + 1; 00027 Thread::wait(500); 00028 } 00029 } 00030 00031 00032 int main() { 00033 Thread th1(led1_thread); 00034 Thread th2(led2_thread); 00035 Thread th3(print_thread); 00036 pc.baud(115200); 00037 while ( b < 300 ) { 00038 pc.printf("\033[1;1H"); 00039 pc.printf("LED_Count"); 00040 pc.printf("\033[2;1H"); 00041 pc.printf("%d",a); 00042 pc.printf("\033[1;15H"); 00043 pc.printf("b++ count"); 00044 pc.printf("\033[2;15H"); 00045 pc.printf("%d",b); 00046 } 00047 pc.printf("\033[1;1H"); 00048 pc.printf("LED_Count"); 00049 pc.printf("\033[2;1H"); 00050 pc.printf("%d",a); 00051 pc.printf("\033[1;15H"); 00052 pc.printf("b++ count"); 00053 pc.printf("\033[2;15H"); 00054 pc.printf("%d",b); 00055 00056 }
Generated on Sun Jul 24 2022 13:12:46 by
1.7.2