From 07dee7bca47e8c54b0fa200e67f62ecd9065ed25 Mon Sep 17 00:00:00 2001 From: Alexandre Bobkov Date: Wed, 6 Aug 2025 04:09:27 -0400 Subject: [PATCH] pwm --- ESP-IDF_Robot/main/rc.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ESP-IDF_Robot/main/rc.h b/ESP-IDF_Robot/main/rc.h index f6760e975..7dc20ea6f 100644 --- a/ESP-IDF_Robot/main/rc.h +++ b/ESP-IDF_Robot/main/rc.h @@ -99,9 +99,23 @@ static void update_pwm (int rc_x, int rc_y) { }*/ // Smooth update + // All forward directions if (y >= 1500) { - m.motor1_rpm_pcm = y - x; - m.motor2_rpm_pcm = ; + m.motor1_rpm_pcm = y - x; // Left side motors, forward + m.motor2_rpm_pcm = y + x; // Right side motors, forward + m.motor3_rpm_pcm = 0; + m.motor4_rpm_pcm = 0; + } + // All reverse directions + if (y <= -1500) { + m.motor1_rpm_pcm = 0; + m.motor2_rpm_pcm = 0; + m.motor3_rpm_pcm = -(y - x); // Left side motors, reverse + m.motor4_rpm_pcm = -(y + x); // Right side motors, reverse + } + // Rotations + if (y < 1500) && (y > 1500) { + } // -------------