🛠 Controlling GPIOs and a Simple Display on Metro ESP32-P4 Hydra

Adafruit Metro ESP32-P4 Hydra · debutant · Apprenez à manipuler les broches d'entrée/sortie et à afficher des données sur un écran compatible via les interfaces MIPI.

Objectifs

This tutorial guides you through discovering the digital inputs/outputs (GPIO) of the Adafruit Metro ESP32-P4 Hydra board. You will learn to configure a pin as an output to control an LED and use the serial interface to monitor system status. Although the board features advanced video interfaces (MIPI DSI), this beginner level focuses on standard GPIOs and USB-C communication to validate your development environment.

Required Hardware

Steps

  1. Environment Setup: Open Arduino IDE. Go to File > Preferences and add the ESP32 board manager URL in the "Additional Board Manager URLs" field. Save.
  2. Add Board: Go to Tools > Board > Boards Manager. Search for "esp32" and install the latest version by Espressif Systems. Restart the IDE.
  3. Select Model: Connect the board to your PC via the USB-C port. In Tools > Board, select ESP32-P4 Dev Module. Ensure the correct serial port is selected in Tools > Port.
  4. Write Code: Create a new sketch. Copy the following code:
const int ledPin = 2; // Standard GPIO pin on the board

void setup() {
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(ledPin, HIGH);
  Serial.println("LED ON");
  delay(1000);
  digitalWrite(ledPin, LOW);
  Serial.println("LED OFF");
  delay(1000);
}
  1. Upload: Click the "Verify" button to compile, then "Upload". Wait for compilation to finish.
  2. Observe: Open the Serial Monitor (Ctrl+Shift+M). Set the speed to 115200 bauds.

Verification

You should see "LED ON" and "LED OFF" messages alternating in the serial monitor every second. If your board has a user LED connected to pin 2, it will blink in sync with these messages. This confirms that USB communication works and GPIOs are correctly controlled.

Going Further

Explore MIPI DSI interfaces to connect a Raspberry Pi-compatible display. Consult ESP-IDF documentation to use the ESP32-C6 coprocessor to enable WiFi and transmit GPIO data via MQTT.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials