Blink not working on BPI-Leaf-S3

I’m trying to get the BPI-Leaf-S3 onboard neo-pixel to blink with the esp-idf framework.
On the board there is printed “GPIO48” below the neo-pixel.

If I use the Arduino framework, it is working fine.
This is the Arduino code: (working) - esp-idf code follows…

    #include <Arduino.h>
    void setup() {
      pinMode(LED_BUILTIN, OUTPUT);
    void loop() {
      digitalWrite(LED_BUILTIN, HIGH);
      digitalWrite(LED_BUILTIN, LOW);
      delay(500);   // wait for a second

LED_BUILTIN is defined in bpi_leaf_s3 > pins_arduino.h :

  static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+48;

with SOC_GPIO_PIN_COUNT being:

#define SOC_GPIO_PIN_COUNT      (49)

So LED_BUILTIN is 49+48 = 97 (unsigned?)

→ This code is working, the pixel blinks and prints 97 to the terminal.

This is the esp-idf code: (not working)

    #include <stdio.h>
    #include "freertos/FreeRTOS.h"
    #include "freertos/task.h"
    #include "driver/gpio.h"
    #include "rom/gpio.h"
    #include "sdkconfig.h"
    #define BLINK_GPIO 97U
    void app_main()
        gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
        while(1) {
            printf("Turning off the LED\n");
            gpio_set_level(BLINK_GPIO, 0);
            vTaskDelay(1000 / portTICK_PERIOD_MS);
            printf("Turning on the LED %d \n", BLINK_GPIO);
            gpio_set_level(BLINK_GPIO, 1);
            vTaskDelay(1000 / portTICK_PERIOD_MS);

→ This compiles, and I get “Turning on the LED 97” in the terminal, but the pixel is not blinking

I tried with 97 instead of 97U, but that makes no difference.
Any thoughts on what I’m doing wrong?


But that also says

so it looks like a deliberate choice of a wrong pin due to hardware bugs?

A neopixel won’t do anything with a regular digitalWrite() , the Neo Pixels need to be spoken to in a specific protocol to make them light up. And per schematics it’s indeed a Neopixel (WS2812B).

Please try the inteded code for this board at

As referenced in their documentatin

For the sketch you might also need to add the library in the platformio.ini with

lib_deps =
   adafruit/Adafruit NeoPixel@^1.10.7

Well, it seems to do that, as the Arduino code shows… The default Arduino blink sketch causes the Neopixel to blink. Would have been handy, but I’ll try with the Adafruit library.
Thanks for the headsup!