RGB LED

The WEMOS S3 MINI PRO includes an onboard RGB LED that can display different colours by controlling its red, green and blue components.

The RGB LED uses:

    • GPIO8 for RGB LED data

    • GPIO7 for RGB LED power control


1. Purpose of the RGB LED

The RGB LED is useful for learning:

    • Digital output

    • GPIO control

    • RGB colour values

    • Delays and timing

    • Loops

    • Functions

    • Program structure

    • Hardware initialization

    • Modifying example programs


2. Hardware Connection

The RGB LED is already built into the S3 MINI PRO board, so no external wiring is required.

Its main connections are:

Function GPIO
RGB LED Data GPIO8
RGB LED Power GPIO7

The power pin must be enabled before the LED can operate.

ESP32-S3
│
├── GPIO7 ───► RGB LED Power
│
└── GPIO8 ───► RGB LED Data


3. Controlling the RGB LED

A typical program begins by importing:

import s3minipro
from machine import Pin

The power line can then be enabled:

power = Pin(s3minipro.RGB_POWER, Pin.OUT, value=1)

Example:

s3minipro.rgb_led(255, 0, 0)


4. Understanding RGB Values

Examples:

s3minipro.rgb_led(255, 0, 0) # Red
s3minipro.rgb_led(0, 255, 0) # Green
s3minipro.rgb_led(0, 0, 255) # Blue
s3minipro.rgb_led(255, 255, 255) # White
s3minipro.rgb_led(0, 0, 0) # Off


5. Example: Cycling Through Colours

import time
import s3minipro
from machine import Pin power = Pin(s3minipro.RGB_POWER, Pin.OUT, value=1) s3minipro.rgb_led(255, 0, 0)
time.sleep_ms(500) s3minipro.rgb_led(0, 255, 0)
time.sleep_ms(500) s3minipro.rgb_led(0, 0, 255)
time.sleep_ms(500) s3minipro.rgb_led(0, 0, 0) power.value(0)


6. How the Program Works



    • Import required modules

    • Enable RGB LED power

    • Set RGB colour values

    • Add delays

    • Turn the LED off

    • Disable power if required


7. Exercises

Possible exercises include:



    • Single-colour output

    • Blinking

    • Colour sequences

    • Repeating patterns

    • Different delay times

    • User-defined colours

    • Functions for colour control

    • LED animations


8. Possible Modifications



    • Change colour values

    • Change delay times

    • Repeat sequences with loops

    • Create smooth colour transitions

    • Create custom colour functions

    • Control the LED with push buttons

    • Use the LED as a status indicator

    • Combine the LED with the display or IMU


9. Programming Concepts Introduced



    • Importing modules

    • Variables

    • GPIO configuration

    • Function calls

    • RGB colour representation

    • Delays

    • Loops

    • Functions

    • Code organization


10. Key Lesson

MicroPython Code
↓
GPIO Control
↓
RGB LED Hardware
↓
Visible Colour
Topic revision: r1 - 19 Nov 2026, JamesInkoom