我找到了基本 arduino 到 arduino 串行通信的示例,但无法让那些在 ESP32 板上工作的示例。我试图在两个 ESP32 之间做同样的事情。两者是连接的:
esp1 esp2
gnd to gnd
tx2 to rx2
rx2 to tx2
简单的草图:
//transmit sketch
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println("test...");
delay(1000);
}
//receive sketch
void setup() {
Serial.begin(9600);
}
void loop() {
String received = "";
while (Serial.available())
{
received = Serial.read();
Serial.println(received);
}
}
完成这项工作还需要什么?