while (!Serial);
pixel.setPixelColor(0, 50, 50, 50); pixel.show();
delay(100);
SerialESP32.begin(baud);
pinMode(SPIWIFI_SS, OUTPUT);
pinMode(ESP32_GPIO0, OUTPUT);
pinMode(ESP32_RESETN, OUTPUT);
// manually put the ESP32 in upload mode
digitalWrite(ESP32_GPIO0, LOW);
digitalWrite(ESP32_RESETN, LOW);
delay(100);
digitalWrite(ESP32_RESETN, HIGH);
pixel.setPixelColor(0, 20, 20, 0); pixel.show();
delay(100);
}
void loop() {
while (Serial.available()) {
pixel.setPixelColor(0, 10, 0, 0); pixel.show();
SerialESP32.write(Serial.read());
}
while (SerialESP32.available()) {
pixel.setPixelColor(0, 0, 0, 10); pixel.show();
Serial.write(SerialESP32.read());
}
}
Code Usage
Unzip the file, and open the SerialESPPassthrough.ino file in the Arduino IDE.
If you're using the AirLift FeatherWing, AirLift Shield or AirLift Bitsy Add-On, use the PassThrough UF2
instructions above
If you have an AirLift Breakout (or are manually wiring up any of the boards above), change the following
pin definitions in the sketch to match your wiring:
#elif !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
// Don't change the names of these #define's! they match the variant ones
#define SerialESP32 Serial1
#define SPIWIFI SPI
#define SPIWIFI_SS 10 // Chip select pin
#define SPIWIFI_ACK 7 // a.k.a BUSY or READY pin
#define ESP32_RESETN 5 // Reset pin
#define ESP32_GPIO0 -1 // Not connected
#define NEOPIXEL_PIN 8
#endif
Using the Arduino IDE, upload the code to your board (
Sketch->Upload
).
After uploading, the board should enumerate USB and appear as a COM or Serial port on your computer.
Make a note of the serial port by checking the Device Manager (Windows) or typing in ls
/dev/cu* or /dev/tty* (Mac or Linux) in a terminal