First try VS Code/PlatformIO to program ESP32-S3 in Arduino Framework, to blink RGB LED.

First try VS Code/PlatformIO to program YD-ESP32-S3 (N16R8) in Arduino Framework, to blink RGB LED.



main.cpp
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>

#define LED_PIN 48       // YD-ESP32-S3 onboard WS2812 (IO48)
#define NUMPIXELS 1      // One RGB LED only

Adafruit_NeoPixel pixels(NUMPIXELS, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  Serial.begin(115200);
  pixels.begin(); 
  pixels.setBrightness(10); // Brightness (0~255)
  Serial.println("Rainbow demo start with brightness 100");
}

uint32_t Wheel(byte pos) {
  pos = 255 - pos;
  if(pos < 85) {
    return pixels.Color(255 - pos * 3, 0, pos * 3);
  } else if(pos < 170) {
    pos -= 85;
    return pixels.Color(0, pos * 3, 255 - pos * 3);
  } else {
    pos -= 170;
    return pixels.Color(pos * 3, 255 - pos * 3, 0);
  }
}

void loop() {
  for(int i = 0; i < 256; i++) {
    pixels.setPixelColor(0, Wheel(i));
    pixels.show();
    delay(20);
  }
}


platformio.ini
[env:esp32s3]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino

; 16MB Flash
board_build.partitions = default_16MB.csv

; 8MB PSRAM (Octal SPI)
board_build.arduino.memory_type = qio_opi
build_flags = -DBOARD_HAS_PSRAM

; the size of the flash memory that can be used for programming.
board_upload.flash_size = 16MB

; NeoPixel (WS2812) Library
lib_deps =
    adafruit/Adafruit NeoPixel

Related:
Install VS Code/PlatformIO in Windows 11


Comments

Popular posts from this blog

Drive 320x240 ILI9341 SPI TFT using ESP32-S3 (NodeMCU ESP-S3-12K-Kit) using TFT_eSPI library, in Arduino Framework.

480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library