Gruppe_A

Dependencies:   mbed

Fork of GruppeA by Andreas Schögler

Files at this revision

API Documentation at this revision

Comitter:
AndreasSchoegler
Date:
Tue Jun 16 16:14:29 2015 +0000
Parent:
0:74db8ce1771f
Commit message:
GruppeA

Changed in this revision

GruppeA.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 74db8ce1771f -r bb1a9447ce78 GruppeA.cpp
--- a/GruppeA.cpp	Wed Jun 10 16:22:46 2015 +0000
+++ b/GruppeA.cpp	Tue Jun 16 16:14:29 2015 +0000
@@ -9,8 +9,14 @@
 
 BusOut doLeds(LED1,LED2,LED3,LED4);
 
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+
 // global vars and objects
-DigitalOut led2(LED2);
+
 Serial pc(USBTX, USBRX); // tx, rx    ; is default !!! (9600, 8N1)
 char recChar=0;
 bool recFlag=false;
@@ -23,6 +29,13 @@
         pc.getc(); 
     } 
 }
+
+void error()
+{
+    
+    
+}
+
     
 void readData() {
     
@@ -45,7 +58,7 @@
            
              
         }
-        if(recArr[0] == 'e' || recArr[0] == 'E')
+        else if(recArr[0] == 'e' || recArr[0] == 'E')
         {
            pc.printf("ein");
            doLeds=15;
@@ -55,13 +68,71 @@
         }
         
         
-        if(recArr[0] == 'L')
+        else if(recArr[0] == 'L' && recArr[3]== 'E')
         {
             
+            switch (recArr[1]) 
+            {
+                case '1':
+                led1 =1;
+                 break;
+                
+                case '2':
+                 led2 =1;
+                  break;
+                
+                case '3':
+                 led3 =1;
+                  break;
+                
+                case '4':
+                 led4 =1;
+                  break;
+                  
+               default: 
+               // fehlerausgabe
+               break;
+            
+            }
             
             
+  
+        }
+        
+        
+        else if(recArr[0] == 'L' && recArr[3]== 'A')
+        {
+            
+            switch (recArr[1]) 
+            {
+                case '1':
+                led1 =0;
+                 break;
+                
+                case '2':
+                 led2 =0;
+                  break;
+                
+                case '3':
+                 led3 =0;
+                  break;
+                
+                case '4':
+                 led4 =0;
+                  break;
+                 
+               default: 
+               // fehlerausgabe
+               break;
+            
+            }
             
             
+  
+        }
+        else
+        {
+         // Fehlerfall   
             
         }
         
@@ -69,11 +140,13 @@
         
         
         
+        
         index = 0; 
         timer1.stop();
         timer1.reset();
         flushSerialBuffer();
         los=0;
+        b=0;
         
     //}
  }
@@ -97,7 +170,7 @@
     flushSerialBuffer();
     if(b>=0)
     {
-    pc.printf("Programm Andreas Schögler Gruppe2 \r\n");
+    pc.printf("Programm Andreas Schoegler Gruppe2 \r\n");
      b=1;
     }