![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
init
Dependencies: aconno_I2C Lis2dh12 WatchdogTimer
Diff: LED.cpp
- Revision:
- 58:8d4a354816b1
- Parent:
- 57:066dfbe8b4b9
diff -r 066dfbe8b4b9 -r 8d4a354816b1 LED.cpp --- a/LED.cpp Thu Feb 13 00:57:06 2020 +0000 +++ b/LED.cpp Mon Feb 17 23:24:52 2020 +0000 @@ -4,6 +4,7 @@ // LED //------------------------------------------------------------------------------ DigitalOut led1(PN_LED); +DigitalOut led2(PN_LED_BLUE); void LED1on(long milliseconds = 0) { led1 = 0; @@ -42,4 +43,42 @@ } void LED1off() { led1 = 1; +} + + + + + +void LED2on(long milliseconds = 0) { + led2 = 0; + if (milliseconds > 0) { + ThisThread::sleep_for(milliseconds); + led2 = 1; + } +} +void LED2blink(int count = 2, long milliseconds = 100) { + for (int i = 0; i < (count*2); i++) { + led2 = !led2; + if (milliseconds > 0) { + ThisThread::sleep_for(milliseconds); + } else { + ThisThread::sleep_for(100); //default if 0 provided + } + } + led2 = 1; +} +void LED2errorCode(int pattern, int count) { + for (int i = 0; i < count; i++) { + for (int p = 0; p < pattern; p++) { + led2 = 0; + ThisThread::sleep_for(200); + led2 = 1; + ThisThread::sleep_for(300); + } + ThisThread::sleep_for(1000); + } + led2 = 1; +} +void LED2off() { + led2 = 1; } \ No newline at end of file