zum Lieniennachfahren

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
georgjonak
Date:
Mon Jun 06 11:35:37 2016 +0000
Commit message:
Lichtsensor zum Liniennachfahren;

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 06 11:35:37 2016 +0000
@@ -0,0 +1,86 @@
+#include "mbed.h"
+ 
+DigitalOut Von (P2_13);      // 12 V ON 
+DigitalOut LineON (P2_5);    // Line Sensor aktivieren
+DigitalIn ISO1 (P1_9);       // ISO1
+DigitalIn ISO2 (P0_16);
+DigitalIn ISO3 (P0_23);
+DigitalIn ISO4 (P0_15);
+DigitalIn ISO5 (P1_3);   
+    
+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);
+
+PwmOut MotorL_EN(P1_19);
+DigitalOut MotorL_FORWARD(P2_15); // Forwerts  
+DigitalOut MotorL_REVERSE(P2_14); // Rückwerts 
+
+PwmOut MotorR_EN(P2_19);
+DigitalOut MotorR_FORWARD(P2_20); 
+DigitalOut MotorR_REVERSE(P2_21);
+
+int main() {
+    Von=1;
+    LineON=1;
+    MotorL_EN=1;
+    MotorR_EN=1;
+    
+
+        while (1) {
+            MotorL_FORWARD = 1;
+            MotorR_FORWARD = 1;
+            MotorL_EN.period_ms (10);
+            MotorR_EN.period_ms (10);
+            MotorL_EN = 0.3f;
+            MotorR_EN.pulsewidth_ms(3);
+            MotorR_EN = 0.3f;
+            MotorL_EN.pulsewidth_ms(3);
+           
+
+        if(ISO1 ==1){
+            LedD1 =1;
+            MotorL_EN = 1.0f;
+            MotorR_EN.pulsewidth_ms(10);
+            MotorR_EN = 1.0f;
+            MotorL_EN.pulsewidth_ms(10);         
+
+        MotorR_FORWARD=0;
+        MotorL_FORWARD=0;
+       
+        MotorR_FORWARD=1;
+        MotorL_REVERSE=1;        
+        }
+        
+        if(ISO4 ==1){
+            LedD1 =1;
+            MotorL_EN = 1.0f;
+            MotorR_EN.pulsewidth_ms(10);
+            MotorR_EN = 1.0f;
+            MotorL_EN.pulsewidth_ms(10);
+
+        MotorR_FORWARD=0;
+        MotorL_FORWARD=0;        
+        MotorL_FORWARD=1;
+        MotorR_REVERSE=1;
+  
+        }
+        wait (0.01); 
+        MotorL_FORWARD=0;
+        MotorR_REVERSE=0; 
+        MotorR_FORWARD=0;
+        MotorL_REVERSE=0;        
+        }}  
+    
+ 
+
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jun 06 11:35:37 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34
\ No newline at end of file