auto-use feather wing pins
unsigned long baud = 115200;
-Adafruit_NeoPixel pixel = Adafruit_NeoPixel(1, 2, NEO_GRB + NEO_KHZ800);
+#if defined(ADAFRUIT_FEATHER_M4_EXPRESS)
+ // Configure the pins used for the ESP32 connection
+ #define SerialESP32 Serial1
+ #define SPIWIFI SPI // The SPI port
+ #define SPIWIFI_SS 13 // Chip select pin
+ #define ESP32_RESETN 12 // Reset pin
+ #define SPIWIFI_ACK 11 // a.k.a BUSY or READY pin
+ #define ESP32_GPIO0 10
+ #define NEOPIXEL_PIN 8
+#endif
+
+Adafruit_NeoPixel pixel = Adafruit_NeoPixel(1, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
@@ -35,18 +46,18 @@ void setup() {
pixel.setPixelColor(0, 50, 50, 50); pixel.show();
delay(100);
- SerialNina.begin(baud);
+ SerialESP32.begin(baud);
- pinMode(13, OUTPUT);
- pinMode(NINA_GPIO0, OUTPUT);
- pinMode(NINA_RESETN, OUTPUT);
+ pinMode(SPIWIFI_SS, OUTPUT);
+ pinMode(ESP32_GPIO0, OUTPUT);
+ pinMode(ESP32_RESETN, OUTPUT);
// manually put the ESP32 in upload mode
- digitalWrite(NINA_GPIO0, LOW);
+ digitalWrite(ESP32_GPIO0, LOW);
- digitalWrite(NINA_RESETN, LOW);
+ digitalWrite(ESP32_RESETN, LOW);
delay(100);
- digitalWrite(NINA_RESETN, HIGH);
+ digitalWrite(ESP32_RESETN, HIGH);
pixel.setPixelColor(0, 20, 20, 0); pixel.show();
delay(100);
}
@@ -57,8 +68,8 @@ void loop() {
SerialESP32.write(Serial.read());
}
- while (SerialNina.available()) {
+ while (SerialESP32.available()) {
pixel.setPixelColor(0, 0, 0, 10); pixel.show();
- Serial.write(SerialNina.read());
+ Serial.write(SerialESP32.read());
}
}
