Hauptprogramm

Dependencies:   ILI9340_Driver_Lib PM2_Libary Lib_DFPlayerMini

Revision:
22:f71d32309307
Parent:
20:f825e91784fe
Child:
26:caa4fab7023e
--- a/Servo/servo_bewegung.cpp	Fri Apr 23 15:33:41 2021 +0000
+++ b/Servo/servo_bewegung.cpp	Fri Apr 23 16:00:39 2021 +0000
@@ -6,33 +6,34 @@
 #define MID         1500
 #define MIN         1000
 #define MAX         2000
-#define STEP          50
+#define MIT          800
+#define STEP          25
 //Time delay between steps in milliseconds
 #define TIME         100
 
 
 void bewegung(){
     Servo servo1(PA_0);
-    servo1.Enable(1000,20000);
+    servo1.Enable(MIN,MAX);
     
     //Servo Bewegung
-    for (int pos = 1000; pos > 800; pos -= 25) {
+    for (int pos = MIN; pos > MIT; pos -= STEP) {
         servo1.SetPosition(pos);
-        thread_sleep_for(STEP);
+        thread_sleep_for(TIME);
     }
     for(int j=0; j<2; j++){
-        for (int pos = 800; pos < 1200; pos += 25) {
+        for (int pos = MIT; pos < MID; pos += STEP) {
             servo1.SetPosition(pos);
-            thread_sleep_for(STEP);
+            thread_sleep_for(TIME);
         }
-        for (int pos = 1200; pos > 800; pos -= 25) {
+        for (int pos = MID; pos > MIT; pos -= STEP) {
             servo1.SetPosition(pos);
-            thread_sleep_for(STEP);
+            thread_sleep_for(TIME);
         }
     }
-    for (int pos = 800; pos < 1000; pos += 25) {
+    for (int pos = MIT; pos < MIN; pos += STEP) {
         servo1.SetPosition(pos);
-        thread_sleep_for(STEP);
+        thread_sleep_for(TIME);
     }
     servo1.Disable();
 }