0:00 Introduction: This tutorial covers basic USART communication with the CH32 microcontroller, building on GPIO manipulation from the previous tutorial.
0:26 USART Importance: USART is crucial due to the chip's lack of native USB, enabling communication with a PC via a USB-to-USART converter (often integrated into the programmer).
2:30 Baud Rate Warning: Emphasizes the importance of matching the baud rate (e.g., 115200) between the microcontroller and the serial terminal on the PC to avoid receiving garbage characters.
3:38 Basic Echo Function (later removed): Demonstrates a simple function that receives a character from the serial terminal and sends it back, showcasing bidirectional communication.
8:56 Toggling LEDs via USART: Implements a function (toggleLED_USART) that toggles individual LEDs (connected to PD0, PD2, PD3, and PC1) based on received characters ('1', '2', '3', '4').
16:25 Reading Button States via USART: Introduces a function to read the state of four buttons (connected to PC0, PC2, PC3, and PC4) and send the status (high or low) back to the serial terminal. Includes debouncing to prevent spurious readings.
22:39 Parsing Commands with Command Character and Number: Develops a more advanced approach to send commands like "L1" (toggle LED 1) or "B2" (read button 2 status).
24:12 Receiving and Storing Commands: Creates a receiveCommand function that receives a command string (up to 9 characters) from the serial terminal and stores it in a buffer.
28:40 Processing Commands: Implements a processCommand function that parses the command buffer:
28:48 LED Toggle Command (L): If the first character is 'L', it extracts the LED number (second character), converts it to an integer, and toggles the corresponding LED if the number is valid (1-4).
35:45 Button Read Command (B): If the first character is 'B', it extracts the button number (second character), converts it to an integer, reads the button's state, and sends "high" or "low" to the serial terminal.
40:36 Summary: Recap of the tutorial, highlighting the ability to send commands to control LEDs, read button states, and parse commands received via USART. Encourages viewers to check the website for resources and support the channel.