AT固件
https://docs.ai-thinker.com/固件汇总
串口接收数据并输出
#include <SoftwareSerial.h>
//自定义串口 (RX, TX) # D6接TX D7接RX
SoftwareSerial MySerial(D6, D7);
String data1; // 接受外部数据
String receive1() { // 接受外部数据
String data;
if (MySerial.available()) {
data = (char)MySerial.read();
data += receive1();
}
return data;
}
void setup() {
Serial.begin(115200); //内部串口初始化
MySerial.begin(115200); //外部串口初始化
}
void loop() {
data1 = receive1();
if (data1 != "") {
Serial.println(data1); //接受的外部数据内部打印
}
MySerial.println("i am fine");
delay(1000);
}
标签:ESP8266,data,代码,实用,MySerial,receive1,串口,data1,String
From: https://www.cnblogs.com/yecss/p/18473209