jeje
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 00004 00005 DigitalOut Led1(PB_5); 00006 DigitalOut Led2(PB_3); 00007 DigitalOut Led3(PA_10); 00008 00009 00010 void blink1( void constant*argument) 00011 { 00012 while(1) 00013 { 00014 Led1= !Led1; 00015 Thread: wait(1000); 00016 } 00017 } 00018 00019 void blink2( void constant*argument) 00020 { 00021 while(1) 00022 { 00023 Led2= !Led2; 00024 Thread: wait(1200); 00025 } 00026 } 00027 00028 void blink3( void constant*argument) 00029 { 00030 while(1) 00031 { 00032 Led3= !Led3; 00033 Thread: wait(1500); 00034 } 00035 } 00036 00037 int main() 00038 { 00039 Thread thread1(blink1, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); 00040 Thread thread2(blink2, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); 00041 Thread thread3(blink3, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); 00042 while (true) 00043 }
Generated on Mon Aug 1 2022 11:35:43 by
1.7.2