![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
GIU\ZF
Dependencies: MCP23017 WattBob_TextLCD mbed-rtos mbed
Fork of rtos_basic by
Diff: tasks/task_group1.cpp
- Revision:
- 20:202e0046527e
- Parent:
- 19:2044bb5d7f29
--- a/tasks/task_group1.cpp Wed Mar 28 01:32:01 2018 +0000 +++ b/tasks/task_group1.cpp Wed Mar 28 14:34:34 2018 +0000 @@ -29,13 +29,19 @@ namespace brakeIndicator{ //Show use of the brake on a LED on the RedBox Unit const float freq = 2.0f; //hz - PwmOut led2(PORT_REDBOX_LED1); + DigitalOut led2(PORT_REDBOX_LED1); static inline void init(){ - led2.period_ms(50); +// led2.period_ms(50); } static inline void hotLoop(){ runTimeParams::liveAccess.lock(); - led2.write(runTimeParams::brakeForce); + if (runTimeParams::brakeForce>0.3f){ +// led2.write(runTimeParams::brakeForce*100.0f); + led2 = 1; + } + else{ + led2 = 0; + } runTimeParams::liveAccess.unlock(); } @@ -44,13 +50,18 @@ //Monitor speed and if it goes over 88 mph switch on a LED on //the RedBox unit static const float freq = 1; //hz - DigitalOut led(PORT_REDBOX_LED1); + DigitalOut led(PORT_REDBOX_LED2); static inline void init(){ led = 0; } static inline void hotLoop(){ runTimeParams::liveAccess.lock(); - led = (runTimeParams::avgSpeed>88); + if (runTimeParams::avgSpeed>88.0f){ + led = 1; + } + else{ + led = 0; + } runTimeParams::liveAccess.unlock(); } @@ -82,8 +93,8 @@ //If both switches are switched on //then flash both indicator LEDs at a rate of 2Hz (hazard mode) if(a&&b){ - lLed.period(2.0f); - rLed.period(2.0f); + lLed.period(0.5f); + rLed.period(0.5f); } else{ lLed.period(1.0f); @@ -97,8 +108,6 @@ - - namespace task_group_1{ Thread thread; const float freq = 2.0f; //hz