![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
none
Fork of thread-example2 by
main.cpp
- Committer:
- WilliamMarshQMUL
- Date:
- 2018-01-13
- Revision:
- 0:83abbbeb9a3d
- Child:
- 1:82ceca58478b
File content as of revision 0:83abbbeb9a3d:
// Simple Example fo use of Threads on mbed OS 5 // Only need to include mbed.h #include "mbed.h" // Variable for a second thread Thread thread; DigitalOut ledA(LED1); // Red LED DigitalOut ledB(LED2); // Green LED // This method is run in the second thread void ledB_thread() { while (true) { Thread::wait(250); ledB = !ledB; } } // This is the main thread int main (void) { ledA = 1 ; // off ledB = 1 ; // off // start the second thread thread.start(callback(ledB_thread)); while (true) { Thread::wait(400); ledA = !ledA; } }