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 Case_Study_rtos_signals2 by
main.cpp@1:6a8fcc666593, 2012-07-13 (annotated)
- Committer:
- emilmont
- Date:
- Fri Jul 13 10:58:06 2012 +0000
- Revision:
- 1:6a8fcc666593
- Parent:
- 0:19f3d184e2ea
- Child:
- 4:3925b40d3296
- Child:
- 5:47c0e14dbd4a
First implementation
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| emilmont | 1:6a8fcc666593 | 1 | #include "mbed.h" |
| emilmont | 1:6a8fcc666593 | 2 | #include "rtos.h" |
| emilmont | 1:6a8fcc666593 | 3 | |
| emilmont | 1:6a8fcc666593 | 4 | DigitalOut led(LED1); |
| emilmont | 1:6a8fcc666593 | 5 | |
| emilmont | 1:6a8fcc666593 | 6 | void led_thread(void const *argument) { |
| emilmont | 1:6a8fcc666593 | 7 | while (true) { |
| emilmont | 1:6a8fcc666593 | 8 | // Signal flags that are reported as event are automatically cleared. |
| emilmont | 1:6a8fcc666593 | 9 | Thread::signal_wait(0x1); |
| emilmont | 1:6a8fcc666593 | 10 | led = !led; |
| emilmont | 1:6a8fcc666593 | 11 | } |
| emilmont | 1:6a8fcc666593 | 12 | } |
| emilmont | 1:6a8fcc666593 | 13 | |
| emilmont | 1:6a8fcc666593 | 14 | int main (void) { |
| emilmont | 1:6a8fcc666593 | 15 | Thread thread(led_thread); |
| emilmont | 1:6a8fcc666593 | 16 | |
| emilmont | 1:6a8fcc666593 | 17 | while (true) { |
| emilmont | 1:6a8fcc666593 | 18 | Thread::wait(1000); |
| emilmont | 1:6a8fcc666593 | 19 | thread.signal_set(0x1); |
| emilmont | 1:6a8fcc666593 | 20 | } |
| emilmont | 1:6a8fcc666593 | 21 | } |
