【Follow me Season 2 Episode 2】+ Getting Started Tasks 【Building Environment, Blink / Serial Port Log Printing】
[Copy link]
Preface
Hello everyone, I am an electronics enthusiast and a participant of the second season of [Follow me]. In this issue, I will explore with you how to build an embedded development environment and start our learning journey through a simple Blink (blinking LED) experiment and serial port log printing. This is not only a learning process, but also a fun journey of exploration. Let's work together to light up our first LED lamp!
1. Preparation
Before we begin, we need to prepare the following tools and equipment:
- A computer (Windows, macOS, or Linux will work)
- A microcontroller development board: Arduino UNO R4 WiFi
- A data cable type-c
- Necessary software, Arduino IDE
2. Development board introduction: Arduino UNO R4 WiFi
Before we start to build the environment, let's first take a look at today's protagonist - Arduino UNO R4 WiFi. This development board is the latest member of the Arduino series. It not only inherits the classic design of the UNO series, but also adds WiFi function, making remote control and data transmission more convenient.
Specifications
Processor: Arm cortex M4
Storage: 256KB Flash/32KB SRAM
Operating voltage: 5V
Input voltage: 6~24V
Clock frequency: 48MHz
Programming port: USB-C
WiFi/Bluetooth: ESP32-S3-MINI
LED matrix: 12x8(96 red LEDs)
Additional connections
Qwiic connector
OFF pin
VRTC pin
Number of digital I/O interfaces: 14
Number of PWM interfaces: 6
Number of ADC interfaces: 6
Number of DAC interfaces: 1(12bit)
Number of SPI interfaces: 1
Number of I2C interfaces: 2
Number of CAN interfaces: 1
Technical data
Arduino UNO R4 WiFi Datasheet
Arduino UNO R4 WiFi Schematic
Arduino UNO R4 WiFi Pinout
Arduino UNO R4 WiFi CAD files
LTR-329 Data Sheet
RA4M1 Data Sheet
RA4M1 Hardware User Manual
SHT40 Data Sheet
The above information is from Follow me Season 2. If you need to see more, please go to
3. Install IDE
First, we need an integrated development environment (IDE) to write and upload code. Taking Arduino IDE as an example, we can download and install it from the Arduino official website .
Arduino Downloads
Download from official website
Official website link---------> Arduino - Home
Arduino Installation
Just click the next step (if you don’t want to put it in the C drive, change it to your own path) I won’t take a screenshot here
Arduino Configuration
When you first come in, you need to ensure that the network is normal and let him download a few files by himself.
Modified to Chinese
Configure the downloaded Arduino to support the latest Arduino uno R4
At this point, the development environment based on Arduino uno R4 has been built. We can select the R4 motherboard and view the official examples in the file option.
4. Blink Experiment
4.1 Writing Code
According to the downloaded schematic diagram,
There are four small lights on the R4, excluding the LED matrix. Two of them are serial port displays, a green light tells us that the power is on, and a yellow light that we can control ourselves, such as making it flash when turning on the power.
P102 is pin 13
Now, let's open the IDE, create a new project, and write the following code to control the LED DL4 blinking:
// 定义LED连接的引脚
int ledPin = 13;
void setup() {
// 设置引脚模式为输出
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH); // 打开LED
delay(500); // 等待0.5秒
digitalWrite(ledPin, LOW); // 关闭LED
delay(500); // 等待0.5秒
}
4.2 Upload code
Upload the code to the development board. If everything goes well, you should see the LED light start blinking.
5. Serial port log printing
5.1 Writing Code
Next, let's add serial printing functionality to our code so we can see the status of the LED and the output of Hello world :
// 定义LED连接的引脚
int ledPin = 13;
void setup() {
Serial.begin(9600); // 初始化串口通信
pinMode(ledPin, OUTPUT);
}
void loop() {
Serial.println("LED状态: ON");
digitalWrite(ledPin, HIGH);
Serial.println("Hello World!");
Serial.println("Hello DigiKey and EEWorld!");
delay(500);
Serial.println("LED状态: OFF");
digitalWrite(ledPin, LOW);
Serial.println("Hello World!");
Serial.println("Hello DigiKey and EEWorld!");
delay(500);
}
After the code is compiled and burned, open the serial port monitor that comes with the IDE, set the same baud rate as the code, and you can see the corresponding serial port output
|