ok

Dependencies:   mbed-rtos mbed

Fork of rtos_timer by mbed official

Committer:
avnisha
Date:
Sun Aug 18 13:27:33 2013 +0000
Revision:
5:f1fd5369b5d5
Parent:
1:c27c61c0a1e0
ok

Who changed what in which revision?

UserRevisionLine numberNew 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 }