first upload

This commit is contained in:
2026-02-24 12:25:50 +08:00
commit c41fa033da
1253 changed files with 836321 additions and 0 deletions

63
MDK-ARM/Car_MOVE.c Normal file
View File

@@ -0,0 +1,63 @@
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "cmsis_os.h"
#include "adc.h"
#include "i2c.h"
#include "tim.h"
#include "usart.h"
#include "gpio.h"
#include "readpin.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "oled.h"
#include "variables.h"
/* USER CODE END Includes */
void car_move(unsigned char ctrl)
{
ctrl = ReadPin();
if(ctrl == 16)
{
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1,0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_2,33999);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_3,0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_4,0);
}
else if(ctrl == 8)
{
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1,33999);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_2,0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_3,0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_4,0);
}
else if(ctrl == 14)
{
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1,0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_2,0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_3,33999);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_4,0);
}
else if(ctrl == 2)
{
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1,0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_2,0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_3,0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_4,33999);
}
else
{
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1,33999);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_2,33999);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_3,33999);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_4,33999);
}
}