Test program making the LEDs blink.
Dependencies: mbed-rtos mbed-src
Fork of TestLPCBlinky by
Diff: main.cpp
- Revision:
- 1:a33626482363
- Parent:
- 0:1bbbbd316896
--- a/main.cpp Tue Sep 23 12:54:34 2014 +0000 +++ b/main.cpp Tue Sep 23 15:05:33 2014 +0000 @@ -1,12 +1,3 @@ -/****************************************************************************** -* DESCRIPTION: -* A "Blinky" CMSIS RTOS program which demonstrates another safe way -* to pass arguments to threads during thread creation. In this case, -* a structure is used to pass multiple arguments. -* AUTHOR: Jose M. Gomez -* LAST REVISED: 23/SEP/2014 -******************************************************************************/ - #include <mbed.h> #include <cmsis_os.h> #include <stdint.h> @@ -14,16 +5,22 @@ #define NUM_THREADS 6 -DigitalOut red(LED1); -DigitalOut green(LED2); -DigitalOut blue(LED3); +PwmOut red(LED1); +PwmOut green(LED2); +PwmOut blue(LED3); void Timer1_Callback (void const *arg) { - red = !red; // update the counter + red = red + 0.01; // update the counter + if(red == 1.){ + red = 0.0; + } } void Timer2_Callback (void const *arg) { - blue=!blue; // update the counter + blue = blue + 0.15; // update the counter + if(blue == 1.){ + blue = 0.0; + } } osTimerDef (timer1, Timer1_Callback);