The display port, and a first build · 09 of 9

Chase the LEDs

One sketch that proves the board is seated, the shield is working and the toolchain uploads: it lights every pin it is safe to drive, one at a time, and leaves the seven that would stop the board alone. No wiring at all.

Twenty-nine lights, seven gaps

The obvious first sketch on a board with an LED on every pin is a loop over every pin. On this board it would crash on the fourth pin it touched.

The chase, pin by pin
not started
Driving
Pins walked
0 of 29
Skipped
43, 44, 19, 20, 35, 36, 37
The sketch lights one pin at a time, left edge first. The crossed-out pins are not in its list. Press run to watch it walk.

So the sketch keeps a list. It has every GPIO at the edge in it, left edge top to bottom and then the right, except the seven the busy-pins page says to leave alone: 43 and 44, 19 and 20, and 35 to 37. Watch the chase skip those rows. That is the sketch doing its job.

Before you upload

Seat the board with its USB sockets over the boxes printed USB. Then plug the cable in, into either socket.

In the Arduino IDE set Tools → Board to ESP32S3 Dev Module, USB CDC On Boot to Enabled if the cable is in the right-hand socket, Flash Size to 16MB and PSRAM to OPI PSRAM. The comment at the top of the sketch carries the same list, so it travels with the file.

The sketch

pinMode(PINS[i], OUTPUT) for every pin in the list is the line that matters. It is what stops those LEDs floating — the flicker from the floating-pin page goes away the moment setup() runs, row by row.

GPIO 0, 3, 45 and 46 are in the list even though the chip reads them at reset. By the time setup() runs that reading is over, and they are ordinary pins.

Reading the result

Open the Serial Monitor at 115200 and you get chasing 29 pins once. That separates the two failures:

  • Nothing printed, nothing lit — the sketch is not running. That is the board or the upload.
  • Printed, and a row stays dark — the sketch is fine. Look at that row: the board's pin in its socket, or the LED beside it.

From here, the reference page has the specifications, what is in the box, and the 3D model and mechanical drawing for designing a case.

The code

chase_the_leds.ino

Walks a light down the left edge and then the right, lights every pin in the list at once, and starts again. It prints the pin count once, so you can tell an upload fault from a shield fault without moving anything.

// ESP32-S3 PinPulse shield: walk a light down every pin it is safe to drive.
//
// Wiring: none. Seat the ESP32-S3 with its two USB sockets over the boxes
// printed USB on the shield, then plug a cable into either socket.
// No 3V3 or GND wire is needed: the LEDs take their power from the board.
//
// Left out on purpose:
//   GPIO 43, 44   serial port, left-hand USB socket
//   GPIO 19, 20   native USB, right-hand USB socket
//   GPIO 35-37    octal PSRAM inside the N16R8 module
//
// Arduino IDE, Tools menu:
//   Board             ESP32S3 Dev Module
//   USB CDC On Boot   Enabled   (Disabled if the cable is in the UART socket)
//   Flash Size        16MB (128Mb)
//   PSRAM             OPI PSRAM
// No library needed.

const int PINS[] = {
  4, 5, 6, 7, 15, 16, 17, 18, 8, 3, 46, 9, 10, 11, 12, 13, 14,  // left edge
  1, 2, 42, 41, 40, 39, 38, 0, 45, 48, 47, 21,                  // right edge
};
const int COUNT = sizeof(PINS) / sizeof(PINS[0]);

void setup() {
  Serial.begin(115200);
  for (int i = 0; i < COUNT; i++) {
    pinMode(PINS[i], OUTPUT);   // driven, so none of these LEDs floats
    digitalWrite(PINS[i], LOW);
  }
  delay(1500);                  // give the native USB port time to enrol
  Serial.printf("chasing %d pins\n", COUNT);
}

void loop() {
  for (int i = 0; i < COUNT; i++) {
    digitalWrite(PINS[i], HIGH);
    delay(80);
    digitalWrite(PINS[i], LOW);
  }
  for (int i = 0; i < COUNT; i++) digitalWrite(PINS[i], HIGH);  // the whole lap at once
  delay(600);
  for (int i = 0; i < COUNT; i++) digitalWrite(PINS[i], LOW);
  delay(300);
}

The list is the whole lesson. It has 29 GPIOs in it, not 36: GPIO 43 and 44 carry the serial port, 19 and 20 the native USB socket, and 35 to 37 the PSRAM inside the N16R8 module. A loop over all 36 would take the board down on the first of those.

When it does not work

The upload fails before the sketch ever runs

That is the ESP32-S3 and the cable, not the shield — uploading never goes through the shield's LEDs. Check the Port in the Tools menu, try the other USB socket, and if it still fails hold BOOT, press and release RST, then release BOOT and upload again.

The chase runs but one LED never lights

Note which GPIO it is from the printed number. If the pin is in the sketch's list, the LED or its inverter channel is at fault, or the board's pin is not seated in that socket position — press the board down along that edge and watch again.

The RGB LED on the ESP32-S3 flashes a colour during the chase

GPIO 48 is in the list, and it is also the RGB LED's data line. The chase's HIGH and LOW look like scrambled data to it. Remove 48 from the array if it bothers you; nothing else changes.

Some LEDs outside the list flicker while it runs

Those are the pins the sketch leaves alone. 43 or 19 and 20 flicker when it prints, depending on which socket the cable is in, and 35 to 37 may flicker with memory use. That is expected, and it is why they are not in the list.

Nothing lights and the Serial Monitor prints nothing

The sketch is not running. Check the board is seated with its USB sockets over the boxes printed USB, then check the upload finished. If the red LED on the ESP32-S3 itself is off, unplug at once: the board may be in end for end.

Where this goes next

Specifications, what is in the box, and the 3D model and drawings for a case.

The reference, and the files

Edit this page — content/books/esp32s3-base/chase-the-leds.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

ESP32-S3 N16R8 PinPulse Shield, 36 GPIO LEDs

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum