Handheld_Node

Dependencies:   XBeeLib buzzer mbed

Revision:
0:2ab14db2fd40
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/functions/breathLed.cpp	Wed Jul 25 09:11:48 2018 +0000
@@ -0,0 +1,32 @@
+#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;
+        }
+    }
+}
\ No newline at end of file