Bertl Programm für den Motor, reagiert auf die Taster. (Falsche Richtung)

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
JulianSteinkellner
Date:
Wed Jun 08 08:05:30 2016 +0000
Commit message:
Bertl2016_Taster

Changed in this revision

BertTaster.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 bd48d1bab7e6 BertTaster.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BertTaster.cpp	Wed Jun 08 08:05:30 2016 +0000
@@ -0,0 +1,135 @@
+#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);
+
+DigitalOut Von (P2_13);           // Motor Spannung ab BERTL15 nötig !
+DigitalOut MotorL_EN(P1_19);      // Enable        OB DIE LINKS ODER RECHTS IST NOCH NICHT KLAR !    
+DigitalOut MotorL_FORWARD(P2_14); // Forwerts  
+DigitalOut MotorL_REVERSE(P2_15); // Rückwerts  
+
+DigitalOut MotorR_EN(P2_19);      //Die Leitung führt zum Pin PO_21 am Prozessor
+DigitalOut MotorR_FORWARD(P2_21); //Die Leitung führt zum Pin P1_3 am Prozessor
+DigitalOut MotorR_REVERSE(P2_20);
+
+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); 
+
+int main()
+{
+    Von = 1;
+    MotorL_EN=MotorR_EN=1;
+    
+    do {
+    if(TA4 == 0)
+        {
+            MotorR_FORWARD=MotorL_FORWARD=0;
+            LedD10=LedD11=LedD12=LedD13=0;
+            LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=1;
+            MotorR_REVERSE=1;
+            MotorL_REVERSE=1;
+            wait(0.5);
+            MotorR_REVERSE=0;
+            MotorL_REVERSE=0;
+            wait(0.5);
+            MotorR_REVERSE=1;
+            wait(0.35);
+            MotorR_REVERSE=0;
+            wait(0.5); 
+        }
+   MotorR_FORWARD=MotorL_FORWARD=1;
+   if(TA6 == 0)
+        {
+            MotorR_FORWARD=MotorL_FORWARD=0;
+            LedD10=LedD11=LedD12=LedD13=0;
+            LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=1;
+            MotorR_REVERSE=1;
+            MotorL_REVERSE=1;
+            wait(0.5);
+            MotorR_REVERSE=0;
+            MotorL_REVERSE=0;
+            wait(0.5);
+            MotorL_REVERSE=1;
+            wait(0.35);
+            MotorL_REVERSE=0;
+            wait(0.5);
+        }
+    MotorR_FORWARD=MotorL_FORWARD=1;
+    if(TA5 == 0)
+        {
+            MotorR_FORWARD=MotorL_FORWARD=0;
+            LedD10=LedD11=LedD12=LedD13=0;
+            LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=1;
+            MotorR_REVERSE=1;
+            MotorL_REVERSE=1;
+            wait(0.5);
+            MotorR_REVERSE=0;
+            MotorL_REVERSE=0;
+            wait(0.5);
+            MotorR_REVERSE=1;
+            wait(0.35);
+            MotorR_REVERSE=0;
+            wait(0.5);
+        }
+    MotorR_FORWARD=MotorL_FORWARD=1;
+    if(TA2 == 0)
+    {
+            MotorR_FORWARD=MotorL_FORWARD=0;
+            LedD10=LedD11=LedD12=LedD13=0;
+            LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=1;
+            MotorR_FORWARD=MotorL_FORWARD=1;
+            wait(1.0);
+            MotorR_FORWARD=MotorL_FORWARD=0;
+            wait(0.5);
+    }
+    MotorR_FORWARD=MotorL_FORWARD=1;
+    
+    if(TA3 == 0)
+    {
+            MotorR_FORWARD=MotorL_FORWARD=0;
+            LedD10=LedD11=LedD12=LedD13=0;
+            LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=1;
+            MotorR_FORWARD=MotorL_FORWARD=1;
+            wait(1.0);
+            MotorR_FORWARD=MotorL_FORWARD=0;
+            wait(0.5);
+    }
+    MotorR_FORWARD=MotorL_FORWARD=1;
+    if(TA8 == 0)
+    {
+            MotorR_FORWARD=MotorL_FORWARD=0;
+            LedD10=LedD11=LedD12=LedD13=0;
+            LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=1;
+            MotorL_FORWARD=1;
+            wait(0.2);
+            MotorL_FORWARD=0;
+    }
+    MotorR_FORWARD=MotorL_FORWARD=1;
+    if(TA7 == 0)
+    {
+            MotorR_FORWARD=MotorL_FORWARD=0;
+            LedD10=LedD11=LedD12=LedD13=0;
+            LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=1;
+            MotorL_FORWARD=1;
+            wait(0.2);
+            MotorL_FORWARD=0;
+    }
+    MotorR_FORWARD=MotorL_FORWARD=1;
+    }while(1);
+}
\ No newline at end of file
diff -r 000000000000 -r bd48d1bab7e6 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jun 08 08:05:30 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file