Antonia Baumgartner / Mbed 2 deprecated YB_copy

Dependencies:   mbed

Fork of Versuch21 by Antonia Baumgartner

Revision:
3:f44ef28cfb2d
Parent:
2:efa9a78591da
Child:
4:3c6d2c035243
--- a/main.cpp	Wed Apr 25 11:16:16 2018 +0000
+++ b/main.cpp	Sun Apr 29 11:29:00 2018 +0000
@@ -12,7 +12,7 @@
 //------------------------------------------------------------------------------
 
 //Motorbefehle von LHR
-int D, sl, sr;
+int D, sl, sr, X;
 Timer timey;
 
 //------------------------------------------------------------------------------
@@ -24,7 +24,7 @@
 AnalogIn sensorValue5(PA_4);        // Seitlicher Sensor rechts
 AnalogIn sensorValue6(PB_0);        // Helligkeitssensor
 DigitalOut myled(LED1);             // LED 1
-DigitalIn button(USER_BUTTON);    // Startknopf
+InterruptIn button(USER_BUTTON);      // Startknopf
 DigitalOut power_5v(PC_4);          // 5V auf Sensoren, geschalten
 
 DigitalOut enable(PC_1);
@@ -63,19 +63,15 @@
     LHR LHR(Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6);
     Spurhaltung spurhaltung(Sensor2, Sensor3);
     Motion motion(counterLeft, counterRight, controller, spurhaltung, Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6);
-
-
-    if(button==1) {
-
-        while (1) {
+    
 
-            D = LHR.moving();
-            //sl = spurhaltung.speedr();
-            //printf("Status: %d\r\n", button);
-            //sr = spurhaltung.speedl();
-            motion.switching(D);
             
+        while (1) {
+            //D = LHR.moving();            
+            printf("X: %d\r\n", X);
+            button.rise(X = 1);
+            //motion.switching(D);        
             
-        }
+       // }
     }
 }
\ No newline at end of file