Lights the barrery LED one-by-one, in an interval of 0.5 seconds. When button A is pressed, the LEDS hold.

Dependencies:   FRDM-TFC mbed

Files at this revision

API Documentation at this revision

Comitter:
NoamVH
Date:
Wed Feb 24 20:56:06 2016 +0000
Child:
1:bb6a452620d1
Commit message:
Activates battery LEDS one-by-one in an interval of 0.5 seconds.; When button A is pressed, the LED hold their current position.

Changed in this revision

FRDM-TFC.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FRDM-TFC.lib	Wed Feb 24 20:56:06 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/ikrase/code/FRDM-TFC/#6cdfa332ec50
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Feb 24 20:56:06 2016 +0000
@@ -0,0 +1,45 @@
+#include "mbed.h"
+#include "TFC.h"
+
+void LED(int i)
+{
+    switch(i) {
+        case 0:
+            TFC_BAT_LED0_ON;
+            break;
+        case 1:
+            TFC_BAT_LED1_ON;
+            break;
+        case 2:
+            TFC_BAT_LED2_ON;
+            break;
+        case 3:
+            TFC_BAT_LED3_ON;
+            break;
+        default:
+            TFC_BAT_LED0_OFF;
+            TFC_BAT_LED1_OFF;
+            TFC_BAT_LED2_OFF;
+            TFC_BAT_LED3_OFF;
+    }
+}
+
+int main()
+{
+    TFC_Init();
+    int i=0;
+    for(;;) {
+        if(TFC_PUSH_BUTTON_0_PRESSED)
+            while(TFC_PUSH_BUTTON_0_PRESSED) {
+                LED(i);
+            }
+
+        else
+            LED(i);
+            wait(0.5);
+            i++;
+            if(i>4)
+                i = 0;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Feb 24 20:56:06 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/252557024ec3
\ No newline at end of file