Example-light up the first LED
Purpose: When you click the light on button, the RGB light is on, and the value of the progress bar increases by 5; when you click the power off button, the RGB light is off, and the value of the progress bar is reduced by 1.
1. Hardware analysis
The schematic diagram of the development board: http://www.wireless-tag.cn/wp-content/uploads/2020/07/WT32-SC01%E8%A7%84%E6%A0%BC%E4%B9%A6V3.3.pdf
Common positive RGB light
Development board interface | RGB light |
---|---|
+3.3V | V (common anode of RGB) |
IO32 | R |
2. Implement UI on the 8ms platform
Designer
Blockly
Step 1: Initialize the pin when booting-set the pin to GPIO33 and select its mode as needed; Set the level of GPIO33 to 1, because it is a common anode and connected to +3.3.
Step 2: Process/Event-When the button is clicked, bind the widget ID-button_on; Set the level of GPIO33 to 0, because it is a common anode and connected to +3.3 (turn on the light).
Step 3: Process/Event-When the button is clicked, bind the widget ID-button_off; Set the level of GPIO33 to 1, because it is a common anode and connected to +3.3 (turn off the light).
3. Effect
- Light-on
- Light-off