1.9k
This is a first example with the ST Nucleo F334R8 board, this uses the mbed online compiler. here is a picture of the board
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. You may have to reverse this.
Code
[codesyntax lang=”cpp”]
#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 } }
[/codesyntax]