![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Handheld_Node
Dependencies: XBeeLib buzzer mbed
functions/breathLed.cpp
- Committer:
- basvuyk
- Date:
- 2018-07-25
- Revision:
- 0:2ab14db2fd40
File content as of revision 0:2ab14db2fd40:
#include "mbed.h" namespace mbed { void breathLed(int systemState){ static double ledVal = 0; static int direction = 1; PwmOut statusLED(PA_11); statusLED.period(0.001f); // Set pwm frequency 1000Hz if (systemState == 1){ if (ledVal > 0.6){ direction = 0; } if (ledVal < 0.03){ direction = 1; } if (direction == 1){ ledVal = ledVal + 0.01; statusLED = ledVal; } else{ ledVal = ledVal - 0.01; statusLED = ledVal; } } else{ statusLED = 0; ledVal = 0; } } }