写真奥から、
GND | GND |
IO0 | 10kΩ抵抗経由で3.3V |
IO2 | 未接続 |
EN | 10kΩ抵抗経由で3.3V |
RST | 10kΩ抵抗経由で3.3V |
TXD | ArduinoのRx |
RXD | ArduinoのTx |
3V3 | 3.3V |
Arduino UNOでは、Rx, Txの代わりに、3.3V⇔5V変換をして、デジタル2, 3番ピンに接続する。
#include <SoftwareSerial.h> SoftwareSerial mySerial(2, 3); // RX, TX void setup() { // Open serial communications and wait for port to open: Serial.begin(115200); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } Serial.println("Goodnight moon!"); // set the data rate for the SoftwareSerial port mySerial.begin(115200); mySerial.println("Hello, world?"); } void loop() { // run over and over if (mySerial.available()) { Serial.write(mySerial.read()); } if (Serial.available()) { mySerial.write(Serial.read()); } }
AT+UART_DEF=9600,8,1,0,0
ESP-WROOM-02をUART Download Modeで使う場合、 ?IO0を10kΩ抵抗経由でGNDに接続 ?IO2を10kΩ抵抗経由で3.3Vに接続