Our Programm to build up from the PES Board Example

Dependencies:   PM2_Libary

Revision:
24:b45ebc28cdf0
Parent:
23:4a0912c80739
diff -r 4a0912c80739 -r b45ebc28cdf0 main.cpp
--- a/main.cpp	Fri Mar 25 21:13:49 2022 +0000
+++ b/main.cpp	Sun Mar 27 01:27:06 2022 +0100
@@ -1,8 +1,6 @@
 #include "mbed.h"
 #include "PM2_Libary.h"
 
-//this is a change for Commiting (delete later)
-
 // logical variable main task
 bool do_execute_main_task = false;  // this variable will be toggled via the user button (blue button) to or not to execute the main task
 
@@ -29,6 +27,8 @@
 float ir_distance_mV = 0.0f;    // define variable to store measurement
 // ???    // create AnalogIn object to read in infrared distance sensor, 0...3.3V are mapped to 0...1
 
+int schritt = 0;
+
 int main()
 {
     // attach button fall and rise functions to user button object
@@ -47,28 +47,39 @@
 
         if (do_execute_main_task) {
 
-            // read analog input
-            // ???
+            switch (schritt) {
+
+        case 0: //initialsiserung
+        initialisierung();
+
+        if(/*stütze oben und keine Treppe erkennbar und boden erkennbar (alle sensoren funktionieren)*/){
+            schritt = 1;
+            reset_initialisierung;
+        }
+        break;
+        
+        case 1: //anfahren bis treppenanschlag
+        break;
 
-            // if the mechanical button is pressed the extra led is blinking
-            if (mechanical_button.read()) {
-                // visual feedback that the main task is executed
-                extra_led = !extra_led;
-            } else {
-                extra_led = 1;
-            }
+        case 2: //Mittelkörper hochfahren
+        break;
+
+        case 3: //vorwärtsfahren bis Mittelkörper auf der Treppe
+        break;
 
-        } else {
+        case 4: //Sttze hochfahren und trpee erkennen
+        break;
 
-            ir_distance_mV = 0.0f;
+        case 5: //Vorwärtsfahren und "abschalten"
+        break;
+        }
+        }
 
-            extra_led = 0;
-        }
+
 
         user_led = !user_led;
 
-        // do only output via serial what's really necessary (this makes your code slow)
-        printf("IR sensor (mV): %3.3f\r\n", ir_distance_mV);
+
 
         // read timer and make the main thread sleep for the remaining time span (non blocking)
         int main_task_elapsed_time_ms = std::chrono::duration_cast<std::chrono::milliseconds>(main_task_timer.elapsed_time()).count();
@@ -76,13 +87,13 @@
     }
 }
 
-void user_button_pressed_fcn()
+void user_button_pressed_fcn() //NH: Darf nicht gelöscht werden!
 {
     user_button_timer.start();
     user_button_timer.reset();
 }
 
-void user_button_released_fcn()
+void user_button_released_fcn() //NH: Darf nicht gelöscht werden!
 {
     // read timer and toggle do_execute_main_task if the button was pressed longer than the below specified time
     int user_button_elapsed_time_ms = std::chrono::duration_cast<std::chrono::milliseconds>(user_button_timer.elapsed_time()).count();
@@ -90,4 +101,30 @@
     if (user_button_elapsed_time_ms > 200) {
         do_execute_main_task = !do_execute_main_task;
     }
+}
+
+
+void initialisierung(){
+
+}
+
+void reset_initialisierung(){
+
+}
+
+
+void prozessschritt_1(){ //initial
+
+}
+
+void reset_Prozessschritt_1(){
+
+}
+
+void prozessschritt_2(){
+
+}
+
+void reset_Prozessschritt_2(){
+
 }
\ No newline at end of file