Professional Documents
Culture Documents
Stepper Acceleration
Stepper Acceleration
Stepper Acceleration
#include "main.h"
int main(void)
{
/* USER CODE BEGIN 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
motorMoveTo(50.50,1,3400);
HAL_Delay(1000);
motorMoveTo(50.50,0,3400);
HAL_Delay(1000);
/* USER CODE END WHILE */
// digitalWrite(DIR, direction);
if (direction == 0)
{
HAL_GPIO_WritePin(DIR_PORT, DIR_PIN, GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(DIR_PORT, DIR_PIN, GPIO_PIN_RESET);
}
if(accSpeed>SMAX){
else
{
if(flag==1){
stepsToStop = i;
flag = 0;
}
}
else
{
if(i < steps-stepsToStop){
}
}
}
/* USER CODE END 4 */