1.接線如下接線:
CH340 ESP8266 Arduino DataPin
TXD -> URXD 13
RXD -> UTXD 12
3.3V -> VCC 3.3V
3.3V -> CH_PD 3.3V
GND -> GND GND

2.編寫代碼
#include <SoftwareSerial.h> SoftwareSerial mySerial(13, 12); // RX, TX void setup() { Serial.begin(115200); Serial.println("Hello,serial!"); // set the data rate for the SoftwareSerial port mySerial.begin(115200); mySerial.println("AT"); } void loop() { // run over and over if (mySerial.available()) { Serial.write(mySerial.read()); } if (Serial.available()) { mySerial.write(Serial.read()); } }
將其中的結束符調為NL和CR 波特率調為115200
發送AT時會收到回復OK
