![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
updated for mbed os 5.4
main.cpp
- Committer:
- noutram
- Date:
- 2019-11-08
- Revision:
- 2:22ab4fcc5293
- Parent:
- 1:cbcb7c2d43cd
File content as of revision 2:22ab4fcc5293:
#include "mbed.h" //Function declarations void Function1(); void Function2(); //I/O DigitalOut onBoardLED(LED1); DigitalOut redLED(D7); DigitalOut yellowLED(D6); DigitalOut greenLED(D5); DigitalIn onBoardSwitch(USER_BUTTON); DigitalIn SW1(D4); DigitalIn SW2(D3); Thread t1, t2; void Function1() { while (true) { redLED = !redLED; ThisThread::sleep_for(2000); //Thread::wait(2000); //Deprecated } } void Function2() { while (true) { yellowLED = !yellowLED; ThisThread::sleep_for(1000); //Thread::wait(1000); //Deprecated } } //Main thread int main() { redLED = 0; yellowLED = 0; //Create and run threads t1.start(Function1); t2.start(Function2); while(1) { //Thread::wait(osWaitForever); //Thread::wait(5000); //Deprecated ThisThread::sleep_for(5000); printf("Awake\n"); //Should not happen } }