例程1、
led2 闪烁
例程2、
串口3 printf打印
led2 闪烁视频
电子产品世界《得捷手势翻页笔活动》 STM32H503RB开发板 官方例程闪烁led2_哔哩哔哩_bilibili
串口3官方例程修改,打印图片
首先对 MX_GPIO_Init();进行io口的配置
再在while(1)循环里面添加 HAL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);
进行led2的翻转
int main(void)
{
/* USER CODE BEGIN 1 */
/* STM32H5xx HAL library initialization:
- Systick timer is configured by default as source of time base, but user
can eventually implement his proper time base source (a general purpose
timer for example or other time source), keeping in mind that Time base
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
handled in milliseconds basis.
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* Initialize BSP Led for LED2 */
BSP_LED_Init(LED2);
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ICACHE_Init();
MX_USART3_UART_Init();
/* USER CODE BEGIN 2 */
/* Output a message on Hyperterminal using printf function */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);
printf("\n\rHello EEPW & DigiKey! Hello STM32H503!\n\r");
/* Insert delay 100 ms */
HAL_Delay(1000);
}
/* USER CODE END 3 */
}