asdf

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
andreashatzl
Date:
Wed Jun 10 16:32:24 2015 +0000
Parent:
1:756c9df9881f
Commit message:
abissiwas

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jun 10 15:41:28 2015 +0000
+++ b/main.cpp	Wed Jun 10 16:32:24 2015 +0000
@@ -16,7 +16,12 @@
 #include "mbed.h"
 // global vars and objects
 BusOut doLeds(LED1,LED2,LED3,LED4);
+DigitalOut led1(LED1);
 DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+InterruptIn diUp(p15);
+Timer timer1;
 Serial pc(USBTX, USBRX); // tx, rx    ; is default !!! (9600, 8N1)
 char recChar=0;
 bool recFlag=false;
@@ -43,30 +48,60 @@
         if(recArr[0]=='a')
         {
             doLeds = 0;
-            };
-        if(recArr[0]=='e')
+            }
+        else if(recArr[0]=='e')
+        {
+            doLeds = 15;
+            }
+        else if(recArr[0]=='A')
+        {
+            doLeds = 0;
+            }
+        else if(recArr[0]=='E')
         {
             doLeds = 15;
-            };
-         if(recArr[0]=='A')
+            }
+        else if(recArr[0]=='t')
         {
-            doLeds = 0;
-            };
-        if(recArr[0]=='E')
-        {
-            doLeds = 15;
-            };
+            doLeds = !doLeds;
+            }
+            
+            
+       else
+       {
+         pc.printf("Eingabe inkorrekt!"); 
+         flushSerialBuffer();
+         while(1)
+         {   timer1.start();
+            if(timer1.read_ms()>=100)
+             {doLeds = !doLeds;
+             timer1.reset();}
+           
+             
+             }
+        }
+        
+  
+        
         
         flushSerialBuffer();
         
     
 }
+
+      void Up()
+{
+    doLeds = 9;
+    return;
+    }
     
 int main() {
+    diUp.rise(&Up);
 //    pc.baud(115200);
     pc.baud(38400);
     pc.format(8, SerialBase::Odd, 2);
-    led2 = 1;
+    doLeds = 0;
+    
 
     flushSerialBuffer();
     pc.printf("Hatzl Andreas: Gruppe A\r\n Bitte geben Sie einen Befehl ein:\r\n");