Compare commits

...

3 commits

Author SHA1 Message Date
jakeg00dwin
4dcfb1ea07 Setup speed control 2025-02-18 16:41:53 -08:00
jakeg00dwin
4adeec5219 Commented out unused link libs. 2025-02-18 16:41:42 -08:00
jakeg00dwin
17bd1a4e38 Added a define for the motor pulse timing, 1uS and 5uS both work well. 2025-02-18 16:41:31 -08:00
3 changed files with 10 additions and 4 deletions

View file

@ -49,6 +49,8 @@
#define SPEED_PIN PB2 // Pin 7/ADC1
#define BUTTON_PIN PB4 // Pin 3 - Button input
#define MOTOR_PULSE 1 //uS motor base pulse
/*The timing of "ticks" is dependent on the AVR timer's counter register
* so for an 8bit register the maximum value is 256. Given we stick with

View file

@ -3,8 +3,8 @@ add_executable(${PROJECT_NAME}
)
target_link_libraries(${PROJECT_NAME}
RegEdit
timer
#RegEdit
#timer
)
# Ensure the build rules are defined

View file

@ -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;