Nucleo F334R8 RGB led example

This is  a basic example with the ST Nucleo F334R8 board, this uses the mbed online compiler.

In this example we flash the red, green and blue colours of an RGB led . Our RGB LED was a common anode type, so a low output switches the LED on and a high output switches the LED off.

 

Code

#include "mbed.h"
 
DigitalOut red(D5);
DigitalOut blue(D8);
DigitalOut green(D9);
 
int main() 
{
    while(1) 
    {
        red = 0; //red on
        wait(1.0); // 1 sec
        red = 1; //red off
        green = 0; //green on
        wait(1.0); // 1 sec
        green = 1; //green off
        blue = 0; //blue on
        wait(1.0); // 1 sec
        blue = 1; // blue off
    }
}

Links
Waveshare STM32 Board Nucleo NUCLEO-F334R8 STM32F334R8 STM32 Development Board Integrate ST-LINK/V2-1 Debugger/Programmer Support Arduino

Share

Comments are closed.