Increment auf D10 & D13 gelegt

Dependencies:   mbed

Fork of _B15Test5 by Gottfried Enenkel

Files at this revision

API Documentation at this revision

Comitter:
Enenkel
Date:
Wed May 27 21:33:41 2015 +0000
Parent:
1:628da1b465a4
Commit message:
Incrementgeber auf D10 & D13 gelegt

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 628da1b465a4 -r 9087cae78c6a main.cpp
--- a/main.cpp	Wed May 27 07:41:01 2015 +0000
+++ b/main.cpp	Wed May 27 21:33:41 2015 +0000
@@ -1,145 +1,25 @@
 /***********************************
-name:   BERTL15_Test1
+name:   BERTL15_Test5
 author: Enenkel 
 description:
-    D1_D4 Lauflicht
+    INCREMENT GEBER TEST
 ***********************************/
- 
 #include "mbed.h"
 
-DigitalOut LedD10 (P1_8); // LED D10 bis D13 IO Definieren
-DigitalOut LedD11 (P1_9);
-DigitalOut LedD12 (P1_10);
+DigitalOut LedD10 (P1_8);      // LED D10 bis D13 IO Definieren
 DigitalOut LedD13 (P1_11);
-DigitalOut LedRT  (P1_24);  //RGB LED
-DigitalOut LedGR  (P1_23);  //
-DigitalOut LedBL  (P1_22);  //  
-
-DigitalOut Von (P1_2);
-I2C i2c(p28, p27);        // die Adressen des I2C Busses am uP 
-                          // p28 -> SDA
-                          // p27 -> SCL 
-
-void RT();
-void BL();
-void GR();
-void WS();
-
-void count();
-void LedSt();
-double counter1;
-int a;
-
-
+DigitalOut Von (P1_2);         // SPANNUNG 10V & 5V 
+DigitalIn incrLI (P1_12);      // Incrementgeber LINKS
+DigitalIn incrRE (P1_13);      // Incrementgeber RECHTS
+DigitalOut incrON (P1_7);      // Incrementgeber ON / OFF
+// *******  Hauptprogramm   ******** //
 int main() {
-    a=1;
-    char btn = 0;
-    //     ****  Config PCA9555 I0 as output *******
-    i2c.start();
-       i2c.write(0x40);   // Adresse des PCA9555 = 40 
-                          // das letzte Bit = 0 -> schreiben  0040 0000
-       i2c.write(0x06);   // Befehl für das IO Port 0 -> siehe SCHEMA des PCA9555
-       i2c.write(0x00);   // Schalte alle Pins des Ports als OUTPUT
-    i2c.stop();    
-    
-    
-    LedRT=1;
-    wait (1);
-    LedRT=0;
-    LedGR=1;
-    wait (1);
-    LedGR=0;
-    LedBL=1;
-    wait (1);
-    LedBL=0;
-    
-    
-    while(1) {
-        counter1=1;
-        
-        while(counter1<5000) {
-            counter1=counter1++;
-        
-            // Einlesen der Taster und speichern unter btn
-            i2c.start();
-                            /* Das letzte Bit der Adresse entscheidet 
-                               ob geschrieben oder gelesen wird. 
-                               0 => schreiben;   1 => lesen  */
-                i2c.write(0x40);    //Adresse & schreiben   0100 0000 
-                i2c.write(0x01);    //aktivate Port 1        
-       
-            i2c.start();
-                i2c.write(0x41);  // Adresse & LESEN    0100 0001  
-                btn = i2c.read(0);// Einlesen des Ports 1 und speichern unter btn
-            i2c.stop();
-        
-            // Schreiben auf Port 0 und damit auf die LED's
-            i2c.start();
-                i2c.write(0x40);  // Adresse & schreiben
-                i2c.write(0x02);  // 
-                i2c.write(~btn);  // schriebn auf Port 0 den INVERSEN Wert von btn
-            i2c.stop();
-        }
-        if (a==1)
-           {
-           RT(); 
-           }    
-        if  (a==2)
-           {
-            GR();   
-           }    
-        
-        
-        
-        a=a++;
-        if (a==4) {
-            a=1;
-            }
-        
-    }
+    Von=1;                     // 5Vund Vmotor  = ON !!! 
+    incrON =1;                 // Incrementgeber aktivieren  
+    while (1)                  // incrLI und incrRE direkt auf die LED gelegt
+      {
+      LedD10= incrLI;
+      LedD13= incrRE;
+      }
 }
-/**************************       ***********************/
-void RT()
-  {
-   LedD10=1;
-   LedD11=LedD12=LedD13=0;   
-   LedRT=1;
-   LedGR=LedBL=0;   
-  }    
-
-void GR()
-  {
-      
-  }    
-
-
-
-
-void count()
-   {
-   a=1;    
-   counter1=counter1++;
-   a=a++;
-   if(a ==5) {
-     
-         a=0;
-     }
- 
- 
- 
-/*     
-   if(counter1 > 10000)
-     {
-     count= 0;
-     if(LedD10 = 1)
-        {
-        LedD10=0;
-        LedD11=1;
-        }
-     if (LedD12=1) 
-        {
-        LedD11=0;    
-        }      
-     }
- */
- }           
\ No newline at end of file
+// ********  END ******  //
\ No newline at end of file