first commit

Dependencies:   PM2_Libary

Revision:
12:3dfd8f2939ac
Parent:
11:af0f165f8761
Child:
13:41bf923cd055
diff -r af0f165f8761 -r 3dfd8f2939ac main.cpp
--- a/main.cpp	Wed Apr 14 12:15:40 2021 +0000
+++ b/main.cpp	Mon Apr 19 08:47:39 2021 +0000
@@ -53,7 +53,7 @@
 Servo servo_S1(PB_2);
 Servo servo_S2(PC_8);
 // Servo servo_S3(PC_6); // PC_6 is used for ultra sonic sensor below
-int servoPeriod_mus = 20000;
+int Ts_pwm_mus = 20000;
 int servoOutput_mus_S1 = 0;
 int servoOutput_mus_S2 = 0;
 int servo_counter = 0;
@@ -80,8 +80,8 @@
     pwmOut_M3.write(0.5);
 
     /* enable servos, you can also disable them */
-    servo_S1.Enable(servoOutput_mus_S1, servoPeriod_mus);
-    servo_S2.Enable(servoOutput_mus_S2, servoPeriod_mus);
+    servo_S1.Enable(servoOutput_mus_S1, Ts_pwm_mus);
+    servo_S2.Enable(servoOutput_mus_S2, Ts_pwm_mus);
 
     while (true) {
 
@@ -103,10 +103,10 @@
             /* command servo position via output time, this needs to be calibrated */
             servo_S1.SetPosition(servoOutput_mus_S1);
             servo_S2.SetPosition(servoOutput_mus_S2);
-            if (servoOutput_mus_S1 <= servoPeriod_mus & servo_counter%loops_per_second == 0 & servo_counter != 0) {
+            if (servoOutput_mus_S1 <= Ts_pwm_mus & servo_counter%loops_per_second == 0 & servo_counter != 0) {
                 servoOutput_mus_S1 += 100;
             }
-            if (servoOutput_mus_S2 <= servoPeriod_mus & servo_counter%loops_per_second == 0 & servo_counter != 0) {
+            if (servoOutput_mus_S2 <= Ts_pwm_mus & servo_counter%loops_per_second == 0 & servo_counter != 0) {
                 servoOutput_mus_S2 += 100;
             }
             servo_counter++;