目标:实现采样读取AD口的电压。
添加全局变量
/* USER CODE BEGIN 1 */
uint16_t ADC1_Value;
/* USER CODE END 1 */
在收到串口指令的时候,进行采样,并在串口打印:
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
unsigned char *pCmd = NULL;
unsigned char buf[128];
int len;
/* Prevent unused argument(s) compilation warning */
UNUSED(huart);
/* NOTE: This function Should not be modif