环境配置: 参考 Arduino IDE 上手教程完成 IDE 安装,并根据实际使用的开发板安装对应的板管理,与需要的驱动库。
使用到的驱动库:
使用到的硬件产品:



1. 核心定义:
2. 关键特性:
3. 工作原理:
1. 核心定义:
2. 关键特性:
3. 工作原理:
G5 (RX)、G6 (TX)。#include <M5Unified.h>
#include <M5GFX.h>
static int cnt;
void setup() {
M5.begin();
M5.Display.clear();
M5.Display.setFont(&fonts::FreeMonoBold9pt7b);
Serial.begin(115200);
// Serial2.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert)
Serial2.begin(115200, SERIAL_8N1, 5, 6);
M5.Display.drawCenterString("Press Screen", 64, 0);
M5.Display.drawCenterString("to send", 64, 15);
Serial.printf("Press screen to send\n");
}
void loop() {
M5.update();
if(M5.BtnA.wasClicked()){
Serial2.printf("RS485/232 Send #%d", ++cnt);
Serial.printf("RS485/232 Send #%d\n", cnt);
M5.Display.fillRect(0, 40, 128, 88, TFT_BLACK);
M5.Display.setCursor(5, 40);
M5.Display.printf("Send: #%d", cnt);
delay(20);
}
// When the RS485/232 interface is disconnected, executing the following code will result in garbled characters.
// while (Serial2.available()) {
// char ch = Serial2.read();
// Serial.write(ch);
// }
}1. 下载模式:不同设备进行程序烧录前需要下载模式,不同的主控设备该步骤可能有所不同。详情可参考Arduino IDE上手教程页面底部的设备程序下载教程列表,查看具体的操作方式。
AtomS3R 长按复位按键 (大约 2 秒) 直到内部绿色 LED 灯亮起,便可松开,此时设备已进入下载模式,等待烧录。
