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.
Dependencies: mbed mbed-rtos 4DGL-uLCD-SE
main.cpp@1:c27c61c0a1e0, 2012-07-13 (annotated)
- Committer:
- emilmont
- Date:
- Fri Jul 13 11:39:26 2012 +0000
- Revision:
- 1:c27c61c0a1e0
- Parent:
- 0:2f5503566475
- Child:
- 5:568a15151d11
First implementation
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| emilmont | 1:c27c61c0a1e0 | 1 | #include "mbed.h" |
| emilmont | 1:c27c61c0a1e0 | 2 | #include "rtos.h" |
| emilmont | 1:c27c61c0a1e0 | 3 | |
| emilmont | 1:c27c61c0a1e0 | 4 | DigitalOut LEDs[4] = { |
| emilmont | 1:c27c61c0a1e0 | 5 | DigitalOut(LED1), DigitalOut(LED2), DigitalOut(LED3), DigitalOut(LED4) |
| emilmont | 1:c27c61c0a1e0 | 6 | }; |
| emilmont | 1:c27c61c0a1e0 | 7 | |
| emilmont | 1:c27c61c0a1e0 | 8 | void blink(void const *n) { |
| emilmont | 1:c27c61c0a1e0 | 9 | LEDs[(int)n] = !LEDs[(int)n]; |
| emilmont | 1:c27c61c0a1e0 | 10 | } |
| emilmont | 1:c27c61c0a1e0 | 11 | |
| emilmont | 1:c27c61c0a1e0 | 12 | int main(void) { |
| emilmont | 1:c27c61c0a1e0 | 13 | RtosTimer led_1_timer(blink, osTimerPeriodic, (void *)0); |
| emilmont | 1:c27c61c0a1e0 | 14 | RtosTimer led_2_timer(blink, osTimerPeriodic, (void *)1); |
| emilmont | 1:c27c61c0a1e0 | 15 | RtosTimer led_3_timer(blink, osTimerPeriodic, (void *)2); |
| emilmont | 1:c27c61c0a1e0 | 16 | RtosTimer led_4_timer(blink, osTimerPeriodic, (void *)3); |
| emilmont | 1:c27c61c0a1e0 | 17 | |
| emilmont | 1:c27c61c0a1e0 | 18 | led_1_timer.start(2000); |
| emilmont | 1:c27c61c0a1e0 | 19 | led_2_timer.start(1000); |
| emilmont | 1:c27c61c0a1e0 | 20 | led_3_timer.start(500); |
| emilmont | 1:c27c61c0a1e0 | 21 | led_4_timer.start(250); |
| emilmont | 1:c27c61c0a1e0 | 22 | |
| emilmont | 1:c27c61c0a1e0 | 23 | Thread::wait(osWaitForever); |
| emilmont | 1:c27c61c0a1e0 | 24 | } |
