Embedded software Assessment 2

Dependencies:   MCP23017 SDFileSystem USBDevice WattBob_TextLCD mbed

Revision:
2:8efdefa03347
Parent:
1:9a3cfeca7ecd
diff -r 9a3cfeca7ecd -r 8efdefa03347 main.cpp
--- a/main.cpp	Sat Feb 15 17:07:18 2014 +0000
+++ b/main.cpp	Sat Feb 15 17:28:23 2014 +0000
@@ -1,31 +1,23 @@
 #include "Function.h"
+
+Ticker timer;
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+
+ int flip = 0;
+ 
+ void attime() {
+     flip = !flip;
+ }
  
-int main(){
-    bool T1=1,T2=1,T3=1,T4=1,T5=1;
-    Init_LCD();
-    TimeA.start();
-    while(1){
-        if((TimeA.read()>2)&&T1){
-            Write_LCD("2Sec",0,0,1);
-            T1=0;
-        }
-        if(TimeA.read()>7&&T2){
-            Write_LCD("7Sec",0,6,0);
-            T2=0;
-        }
-        if(TimeA.read()>8&&T3){
-            Write_LCD("8Sec",0,11,0);
-            T3=0;
-        }
-        if(TimeA.read()>11&&T4){
-            Write_LCD("11Sec",1,0,0);
-            T4=0;
-        }
-        if(TimeA.read()>21&&T5){
-            Write_LCD("21Sec",1,9,0);
-            T5=0;
-            TimeA.reset();
-            T1=1,T2=1,T3=1,T4=1,T5=1;
-        }
-    }        
+ int main() {
+     timer.attach(&attime, 3);
+     while(1) {
+         if(flip == 0) {
+             led1 = !led1;
+         } else {
+             led2 = !led2;
+         }
+         wait(0.1);
+     }        
 }
\ No newline at end of file