Vorher bitte schauen welche Taster was bewirken

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
benjaminmoerth
Date:
Thu May 26 10:08:35 2016 +0000
Commit message:
Programm2

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 8c0ba8d4b439 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 26 10:08:35 2016 +0000
@@ -0,0 +1,109 @@
+#include "mbed.h"
+
+DigitalOut LedD1 (P1_10);      
+DigitalOut LedD2 (P1_11);
+DigitalOut LedD4 (P1_12);
+DigitalOut LedD5 (P1_13);
+DigitalOut LedD6 (P1_14);      
+DigitalOut LedD7 (P1_15);
+DigitalOut LedD8 (P1_16);
+DigitalOut LedD9 (P1_17);
+DigitalOut LedD10 (P1_18);     
+DigitalOut LedD11 (P2_16);
+DigitalOut LedD12 (P1_20);
+DigitalOut LedD13 (P1_21);
+
+DigitalIn TA1 (P1_23);      //
+DigitalIn TA2 (P1_24);
+DigitalIn TA3 (P1_25); //
+DigitalIn TA4 (P1_26);
+DigitalIn TA5 (P1_27);//  
+DigitalIn TA6 (P1_28);//
+DigitalIn TA7 (P1_30);//
+DigitalIn TA8 (P1_31);//
+
+
+DigitalOut Von (P2_13);           // Motor Spannung ab BERTL15 nötig !
+
+PwmOut MotorL (P1_19);
+DigitalOut MotorL_EN(P1_19);      // Enable        OB DIE LINKS ODER RECHTS IST NOCH NICHT KLAR !    
+DigitalOut MotorL_FORWARD(P2_15); // Forwerts  
+DigitalOut MotorL_REVERSE(P2_14); // Rückwerts  
+
+PwmOut MotorR (P2_19);
+DigitalOut MotorR_EN(P2_19);      //Die Leitung führt zum Pin PO_21 am Prozessor
+DigitalOut MotorR_FORWARD(P2_20); //Die Leitung führt zum Pin P1_3 am Prozessor
+DigitalOut MotorR_REVERSE(P2_21);
+
+int main()
+{
+    Von = 1;
+    MotorL_EN=MotorR_EN=1;
+    
+    MotorL_FORWARD=MotorR_FORWARD=1;
+    LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=1; // Alle Leds ausgeschalten
+    LedD1=LedD4=0;
+    
+    while(1)
+    {
+    if(TA7 == 0)
+    {
+        LedD5=0;
+        wait(0.2);
+        LedD5=1;
+        wait(0.2);
+        LedD5=0;
+        wait(0.2);
+        LedD5=1;
+        
+        MotorL_FORWARD=MotorR_FORWARD=0;
+        LedD7=LedD9=0;
+        wait (1);
+        MotorL_FORWARD=1;
+        LedD7=LedD9=1;
+        wait(0.5);
+        MotorR_FORWARD=1;
+    }
+    
+    if(TA8 == 0)
+    {
+        LedD2=0;
+        wait(0.2);
+        LedD2=1;
+        wait(0.2);
+        LedD2=0;
+        wait(0.2);
+        LedD2=1;
+        
+        MotorL_FORWARD=MotorR_FORWARD=0;
+        LedD7=LedD9=0;
+        wait (1);
+        MotorR_FORWARD=1;
+        LedD7=LedD9=1;
+        wait(0.5);
+        MotorL_FORWARD=1;
+    }
+    
+    if (TA3 == 0)
+    {
+     MotorL_FORWARD=MotorR_FORWARD=0;   
+     LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=0;
+     wait(3);
+     LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=1;
+     LedD1=LedD4=0;
+     MotorL_REVERSE=MotorR_REVERSE=1; 
+     LedD7=LedD9=0;
+     wait (1);
+     MotorL_REVERSE=MotorR_REVERSE=0;
+     LedD7=LedD9=1;
+     wait(0.2);
+     MotorL_FORWARD=MotorR_FORWARD=1; 
+    }
+    
+
+    
+    }
+    
+    
+}
+
diff -r 000000000000 -r 8c0ba8d4b439 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 26 10:08:35 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34
\ No newline at end of file