Tuan Le / Mbed 2 deprecated AccelerometerProject

Dependencies:   MMA8452 N5110 PowerControl beep mbed

Revision:
3:1974db5993ef
Child:
5:c0a58a6916f2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Accel-cize.cpp	Mon May 04 15:55:32 2015 +0000
@@ -0,0 +1,47 @@
+#include "MMA8452Test.h"
+#include "PowerControl/PowerControl.h"
+#include "GameFSM.h"
+
+AnalogIn adjust(p20);
+Timer t;
+FSM program;
+
+int main()
+{
+    Test init;
+    init.initial();
+
+    ButtonU.rise(&BuUPress);
+    ButtonD.rise(&BuDPress);
+    ButtonA.rise(&BuAPress);
+    ButtonB.rise(&BuBPress);
+
+    while(1) {
+        lcd.setBrightness(adjust);
+
+        program.proact();
+        
+        //////// Timer for the mbed go to sleep mode when waiting for 2 mins ////////
+        /*resetButton();
+        if ((BuAFlag || BuBFlag || BuDFlag || BuUFlag) == 0) {
+            t.start();
+            float time = t.read();
+            char buffer[14];
+            sprintf(buffer,"Time: %0.1f",time);
+            lcd.printString(buffer,0,5);
+        }
+        if (t.read() < 10 && (BuAFlag || BuBFlag || BuDFlag || BuUFlag) > 1) {
+            t.reset();
+            t.start();
+            resetButton();
+        } else if(t.read() > 10 && (BuAFlag || BuBFlag || BuDFlag || BuUFlag) == 0) {
+            lcd.setBrightness(0);
+            t.stop();
+            t.reset();
+            sleep();
+            if ((BuAFlag || BuBFlag || BuDFlag || BuUFlag) > 1) {
+                resetButton();
+            }
+        }*/
+    }
+}
\ No newline at end of file