Bertl wendet wenn Taster(Endschalter) anschlägt.

Dependencies:   mbed

Bertl wendet wenn Taster(Endschalter) anschlägt.

Files at this revision

API Documentation at this revision

Comitter:
Lenschinki
Date:
Fri May 20 19:54:59 2016 +0000
Commit message:
Bertl wendet wenn Taster(Endschalter) anschl?gt.

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 f141ed23b8f0 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri May 20 19:54:59 2016 +0000
@@ -0,0 +1,83 @@
+#include "mbed.h"
+
+
+DigitalOut Von (P2_13);      // 12 V ON 
+
+DigitalOut MotorL_EN(P1_19);  // Enable  OB DIE LINKS ODER RECHTS IST NOCH NICHT KLAR !    
+DigitalOut MotorL_For(P2_14); // Forwerts  
+DigitalOut MotorL_Rev(P2_15); // Rückwerts  
+
+DigitalOut MotorR_EN(P2_19);      //Die Leitung führt zum Pin PO_21 am Prozessor
+DigitalOut MotorR_For(P2_21);     //Die Leitung führt zum Pin P1_3 am Prozessor
+DigitalOut MotorR_Rev(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);
+
+//For = Forward
+//Rev = Reverse
+
+
+void wenden(); //Voids zum wenden des Bertls
+void wendenRev();
+
+int main() {
+    Von = 1;
+    MotorL_EN = MotorR_EN = 1;
+    while(1) {
+            
+          
+            if(Ta1 == 0){  //Wenn taster anschlägt dann wendet der Bertl
+            wenden(); 
+            }
+            if(Ta2 == 0){
+            wenden(); 
+            }
+            if(Ta3 == 0){
+            wenden(); 
+            }
+            if(Ta7 == 0){
+            wenden(); 
+            }
+            if(Ta8 == 0){
+            wenden(); 
+            }
+            if(Ta4 == 0){
+            wendenRev();  
+            }
+            if(Ta5 == 0){
+            wendenRev();
+            }
+            if(Ta6 == 0){
+            wendenRev();
+            }
+            
+         MotorL_Rev = MotorR_Rev = 1; //Wenn kein Taster aktiv dann gerade aus 
+         wait(0.05); 
+            
+    }    
+}
+void wenden(){
+            MotorL_Rev = MotorR_Rev = 0;
+            wait(0.1);
+            MotorL_For = MotorR_For = 1;
+            wait(0.3);
+            MotorL_For = 0; 
+            wait(0.4);
+            MotorR_For = 0;  
+    }
+void wendenRev() {
+            MotorL_Rev = MotorR_Rev = 0;
+            wait(0.1);
+            MotorL_Rev = MotorR_Rev = 1;
+            wait(0.3);
+            MotorR_Rev = 0; 
+            wait(0.4);
+            MotorL_Rev = 0;  
+    }
diff -r 000000000000 -r f141ed23b8f0 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri May 20 19:54:59 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7c328cabac7e
\ No newline at end of file