init
Dependencies: aconno_I2C Lis2dh12 WatchdogTimer
Diff: LED.cpp
- Revision:
- 57:066dfbe8b4b9
- Parent:
- 51:9078e6928412
- Child:
- 58:8d4a354816b1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LED.cpp Thu Feb 13 00:57:06 2020 +0000
@@ -0,0 +1,45 @@
+#include "LED.h"
+
+//------------------------------------------------------------------------------
+// LED
+//------------------------------------------------------------------------------
+DigitalOut led1(PN_LED);
+
+void LED1on(long milliseconds = 0) {
+ led1 = 0;
+ if (milliseconds > 0) {
+ ThisThread::sleep_for(milliseconds);
+ //Thread::wait(milliseconds);
+ led1 = 1;
+ }
+}
+void LED1blink(int count = 2, long milliseconds = 100) {
+ for (int i = 0; i < (count*2); i++) {
+ led1 = !led1;
+ if (milliseconds > 0) {
+ //Thread::wait(milliseconds);
+ ThisThread::sleep_for(milliseconds);
+ } else {
+ //Thread::wait(100);
+ ThisThread::sleep_for(100); //default if 0 provided
+ }
+ }
+ led1 = 1;
+}
+void LED1errorCode(int pattern, int count) {
+ for (int i = 0; i < count; i++) {
+ for (int p = 0; p < pattern; p++) {
+ led1 = 0;
+ //Thread::wait(200);
+ ThisThread::sleep_for(200);
+ led1 = 1;
+ //Thread::wait(300);
+ ThisThread::sleep_for(300);
+ }
+ ThisThread::sleep_for(1000);
+ }
+ led1 = 1;
+}
+void LED1off() {
+ led1 = 1;
+}
\ No newline at end of file