Alle LED's leuchten bei verschiedenen Lichtstärkern SW1 Sw2 Sw3 Sw4 Taster test

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
hennespatrick
Date:
Thu Jun 18 09:52:32 2015 +0000
Parent:
1:f619bd48aa06
Commit message:
Updated.;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r f619bd48aa06 -r 429135263e22 main.cpp
--- a/main.cpp	Thu Jun 18 09:19:36 2015 +0000
+++ b/main.cpp	Thu Jun 18 09:52:32 2015 +0000
@@ -1,6 +1,6 @@
 
 #include "mbed.h"
-// ********   Definitionen  **********
+
 Serial pc(USBTX, USBRX);
 
 // Definition der Taster (Switches)
@@ -23,35 +23,38 @@
 DigitalOut ledD19(P1_12);
 DigitalOut ledD20(P1_13);
 
-// RGB LED
 
 // LDR Input
 AnalogIn LDR(P0_12);      // Analoges einlesen des LDR 
 int a;
+
+
 // Hauptprogramm 
 int main()
 {
     char readChar = 0;
     pc.printf("Welcome to BERTL14\n\r");
-       
+
+
 // ****************   TASTER TEST   ********************
      pc.printf("TASTER und LDR TEST\n\r");
      while(1) {
-        if (sw4==1)                                       
+        if (sw4==1)                                         
           ledD1=1;    
         else {   
-          ledD1=0;         
+          ledD1=0;        
            }          
-        wait (0.001);    
+        wait (0.001);      
                                             
         if (sw3==1)    
           ledD2=1;    
+        else {        
           ledD2=0; 
           }  
            wait (0.001);  
-        if (sw2==1) 
+        if (sw2==1)   
           ledD4=1;  
-        else {         
+        else {      
           ledD4=0; }
           wait (0.001);   
           
@@ -60,44 +63,74 @@
         else {          
           ledD3=0;  
           }  
-        wait (0.001);        
-
+        wait (0.001);   
+        
 /*************** LDR TEST *******************************/        
         if(LDR <= 0.2)
            ledD1=1;
            else
            ledD1=0;
         
-        if(LDR <= 0.07)      
-           ledD4 = 1;       
+        if(LDR <= 0.07)       
+           ledD2 = 1;       
            else
-           ledD4 = 0;
+           ledD2 = 0;
         
-        if (LDR <= 0.10)
+        if (LDR <= 0.1)
            ledD3=1;
            else
            ledD3=0;
         
-        if (LDR <= 0.12)
-           ledD2=1;
+        if (LDR <= 0.10)
+           ledD4=1;
            else
-           ledD2=0;
+           ledD4=0;
            
-        if (LDR <= 0.13)
+       if (LDR <= 0.07)
            ledD13=1;
            else
            ledD13=0;
            
-      if (LDR <= 0.15)
-           ledD15=1;
-           else
-           ledD15=0;
-           
-              if (LDR <= 0.17)
+       if (LDR <= 0.1)
            ledD14=1;
            else
            ledD14=0;
            
-         wait (0.01);                         
+      if (LDR <= 0.10)
+           ledD15=1;
+           else
+           ledD15=0;           
+           
+      if(LDR <= 0.07)       
+           ledD16 = 1;       
+           else
+           ledD16 = 0;
+           
+      if (LDR <= 0.1)
+           ledD17=1;
+           else
+           ledD17=0;
+           
+      if (LDR <= 0.10)
+           ledD18=1;
+           else
+           ledD18=0;  
+           
+     if (LDR <= 0.1)
+           ledD18=1;
+           else
+           ledD18=0;  
+           
+     if(LDR <= 0.07)       
+           ledD19 = 1;       
+           else
+           ledD19 = 0;
+           
+     if (LDR <= 0.10)
+           ledD20=1;
+           else
+           ledD20=0;           
+           
+         wait (0.01);  
 }
 }