Page 324 - MDP2022-2
P. 324
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
volatile int count=0; //motor angle
volatile int start=0; //motor start flag
volatile int togglePIN=0; //i don't know
void MOTOR(){// motor hamsoo
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, GPIO_PIN_SET); //motor direction
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_SET); //idiot PWM
HAL_Delay(6); //delay can control motor speed
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET); //idiot PWM
HAL_Delay(6); //delay can control motor speed
count++; //angle
}
void MOTORr(){// revers motor hamsoo
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, GPIO_PIN_RESET); //motor direction
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_SET); //idiot PWM
HAL_Delay(6); //delay can control motor speed
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET); //idiot PWM
HAL_Delay(6); //delay can control motor speed
count--; //revers angle
}
/* USER CODE END 0 */
/**
* @brief The application entry point.