William Singleton
/
595_Lab_8_Part_II_MUTEX
Part 2 lab 8
main.cpp@8:c1e1db61aee7, 2017-01-12 (annotated)
- Committer:
- mab5449
- Date:
- Thu Jan 12 22:58:45 2017 +0000
- Revision:
- 8:c1e1db61aee7
- Parent:
- 7:8d9919175929
- Child:
- 9:dd58814e2dcf
Updating to mbed OS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 1:491820ee784d | 1 | #include "mbed.h" |
emilmont | 1:491820ee784d | 2 | |
emilmont | 1:491820ee784d | 3 | DigitalOut led1(LED1); |
emilmont | 1:491820ee784d | 4 | DigitalOut led2(LED2); |
geky | 7:8d9919175929 | 5 | Thread thread; |
emilmont | 1:491820ee784d | 6 | |
geky | 7:8d9919175929 | 7 | void led2_thread() { |
emilmont | 1:491820ee784d | 8 | while (true) { |
emilmont | 1:491820ee784d | 9 | led2 = !led2; |
emilmont | 1:491820ee784d | 10 | Thread::wait(1000); |
emilmont | 1:491820ee784d | 11 | } |
emilmont | 1:491820ee784d | 12 | } |
emilmont | 1:491820ee784d | 13 | |
emilmont | 1:491820ee784d | 14 | int main() { |
geky | 7:8d9919175929 | 15 | thread.start(led2_thread); |
emilmont | 1:491820ee784d | 16 | |
emilmont | 1:491820ee784d | 17 | while (true) { |
emilmont | 1:491820ee784d | 18 | led1 = !led1; |
emilmont | 1:491820ee784d | 19 | Thread::wait(500); |
emilmont | 1:491820ee784d | 20 | } |
emilmont | 1:491820ee784d | 21 | } |