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.
Fork of Task611-mbedos54 by
main.cpp
00001 #include "mbed.h" 00002 00003 00004 //Function declarations 00005 void Function1(); 00006 void Function2(); 00007 00008 //I/O 00009 DigitalOut onBoardLED(LED1); 00010 DigitalOut redLED(D7); 00011 DigitalOut yellowLED(D6); 00012 DigitalOut greenLED(D5); 00013 00014 DigitalIn onBoardSwitch(USER_BUTTON); 00015 DigitalIn SW1(D4); 00016 DigitalIn SW2(D3); 00017 00018 Thread t1, t2; 00019 00020 void Function1() 00021 { 00022 while (true) { 00023 redLED = !redLED; 00024 Thread::wait(2000); 00025 } 00026 } 00027 00028 void Function2() 00029 { 00030 while (true) { 00031 yellowLED = !yellowLED; 00032 Thread::wait(1000); 00033 } 00034 } 00035 00036 //Main thread 00037 int main() { 00038 redLED = 0; 00039 yellowLED = 0; 00040 00041 //Create and run threads 00042 t1.start(Function1); 00043 t2.start(Function2); 00044 00045 while(1) { 00046 //Thread::wait(osWaitForever); 00047 Thread::wait(5000); 00048 printf("Awake\n"); //Should not happen 00049 } 00050 }
Generated on Fri Jul 15 2022 06:14:09 by
1.7.2