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 // Title : mbed-os-3-threads 00002 // Author: Jacques-Olivier Klein - IUT de CACHAN 00003 // Date: 2018-02-10 00004 00005 #include "mbed.h" 00006 #include "IHM.h" 00007 00008 IHM ihm; 00009 00010 DigitalOut L0 (PB_3) ; // led L0 00011 DigitalOut L1 (PA_7) ; // led L1 00012 DigitalOut L2 (PA_6) ; // led L2 00013 00014 void led1_thread(); 00015 void led2_thread(); 00016 00017 Thread thread1 (osPriorityNormal,2*OS_STACK_SIZE ); 00018 Thread thread2 (osPriorityNormal,2*OS_STACK_SIZE ); 00019 00020 // main is the 1st thread 00021 int main(void) 00022 { ihm.LCD_clear(); 00023 ihm.LCD_printf("3-threads-%s %s",__DATE__,__TIME__); 00024 printf("mbed-os-3-threads-%s %s\n\r",__DATE__,__TIME__); 00025 printf("DEFAULT_STACK_SIZE:%d\n\r", OS_STACK_SIZE); 00026 00027 thread1.start(led1_thread); 00028 thread2.start(led2_thread); 00029 00030 while(1){ 00031 L0=!L0; 00032 printf("* [pid-%d]Main \n\r",osThreadGetId()); 00033 wait(0.0200); 00034 } 00035 } 00036 00037 void led1_thread(){ 00038 while (1) { 00039 L1 = ! L1; 00040 printf(" * [pid-%d]led1_thread \n\r",osThreadGetId()); 00041 wait(0.500); 00042 } 00043 } 00044 00045 void led2_thread(){ 00046 while (1) { 00047 L2 = ! L2; 00048 printf(" *[pid-%d]led2_thread \n\r",osThreadGetId()); 00049 wait(2.500); 00050 } 00051 } 00052 00053
Generated on Sat Aug 20 2022 10:21:16 by
1.7.2