From 4dcfb1ea0751a8a51da23e4d60a340f23cae5d60 Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Tue, 18 Feb 2025 16:41:53 -0800 Subject: [PATCH] Setup speed control --- src/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 14da7c1..d2413a5 100644 --- a/src/main.c +++ b/src/main.c @@ -152,9 +152,13 @@ void MotorMoveTo(uint8_t target) { } // The delay ratio controlls the PWM waveforms. - _delay_ms((double)on_delay); + for(uint8_t i = 0; i < on_delay; i++){ + _delay_us(MOTOR_PULSE); + } MotorCoast(); - _delay_ms((double)off_delay); + for(uint8_t i = 0; i < off_delay; i++){ + _delay_us(MOTOR_PULSE); + } } return;