Young creators, if we say that time blocks set the "rhythm" for a program, then device blocks are what let the program "control the body of the development board"! A development board is just like a tiny robot, with its own "brain"(CPU), "hands and feet"(pins), and "senses"(sensors), and device blocks are the "remote controls" we use to command all these components to get to work.
With these building blocks, we can figure out exactly what the development board "can do" — for example, how fast its "brain" runs, which pin it can power on, what sensor signals it can read, and even how to control external small lights, motors and buttons. Simply put, device-related building blocks act as the "interpreter" between the program and hardware, turning the code we write into actions that the development board can understand, and bringing the cold circuit board to life!
The development board can control peripheral devices entirely thanks to its internal "core components" — we don't need to delve deep into the underlying principles; just remember these two key parts:
- Processor (CPU): The "brain" of the development board The CPU is just like the class monitor — it is responsible for running the block-based programs we write, receiving signals from peripherals (such as a button press), and then sending commands to control peripherals (such as spinning a fan). Beginners only need to remember this: A program must be downloaded to the CPU to run, and a peripheral must be connected to the CPU to be controlled!
- Input/Output Pins: The "Hands and Feet" of the Development Board If the CPU is the brain, then the pins are the "hands" and "feet" of the development board —
- Input pin: It acts like a "hand" that receives signals — for example, the light data detected by a sensor or the command of a pressed key is transmitted to the CPU through it;
- Output pin: It acts like a "foot" that transmits commands — for example, signals to turn on an LED or trigger a buzzer are sent to external peripherals through this pin.
- In our kit, the pins are categorized into several types of interfaces according to their functions:
- DIO Interface (Digital Pin): It only has two states, "powered (high level)" and "unpowered (low level)", just like a switch, making it suitable for controlling LEDs, buttons and buzzers;
- AIN Interface (Analog Pin): Capable of receiving continuously varying signals, such as the numerical change of light from dark to bright, it is suitable for connecting light intensity sensors and sliding rheostats;
- I2C/UART Interface (Communication Pins): Enables "communication" with peripheral devices to transmit complex data, making it suitable for connecting advanced modules such as OLED displays and gyroscopes.
📌 Key Quick Rules
- Pins have fixed numbers (e. g., GPIO6, GPIO26), and the correct number must be selected in the program for the peripheral to work properly;
- The GND pins of all peripherals must be connected to the GND of the development board (common grounding), otherwise the signals will jump erratically!
Tips
Device blocks directly operate the hardware of the development board. When beginners use them, do not modify the core settings (such as CPU frequency) at will. Prioritize "reading status and observing data" first, and try to control them after getting familiar with them!
✨ Interactive Quick Question
- Think about it: What similarities do you think the "brain"(CPU) of a development board shares with the human brain? (Answer: Both are core command centers that control all actions and thoughts~)
- Quick response quiz: What is the function of device building blocks? (Answer: To control the functions of the development board itself and the status of its pins, enabling programs to manipulate hardware~)