RGB LED'S
STM32-Experiments Free Updated Sep 20, 2026

RGB LED'S

RGB LED

Remember dimming a single LED with a potentiometer back in Experiment 3? We're taking that exact same trick and tripling it. An RGB LED is really just three LEDs, red, green, and blue, squeezed into one package, and by controlling the brightness of each independently with PWM, we can blend them into pretty much any color you like. This experiment sweeps all three automatically, producing a smooth, continuously shifting rainbow effect.

 

2. Scope

We'll set up three PWM channels on a single timer, one per color, and write a small routine that ramps each channel's brightness up and down on a staggered offset, so the colors blend into each other rather than all changing in lockstep. This builds directly on the single-channel PWM skill from Experiment 3, just scaled up to three channels running simultaneously.

3. Prerequisite

3.1 Hardware

  • STM32 Nucleo-F070RB development board

  • RGB LED (common-cathode or common-anode, 4-pin)

  • Three 220Ω resistors, one per color channel

  • Breadboard and jumper wires

  • Micro-USB cable

3.2 Software

  • STM32CubeMX (standalone)

  • STM32CubeIDE

  • ST-LINK USB driver

Community Q&A

0 questions

Ask questions and get answers from our community and staff moderators.

No questions yet — be the first to start the conversation!

Ask a Question

Please log in to ask a question or post a reply.

Login to Participate