mbed STM32F4DISCOVERY 简单 LED 演示
此演示展示如何使用 mbed 控制 STM32F4DISCOVERY LED。 我在 PlatformIO 内部使用 mbed。
mbed-led-demo.cpp
#include <mbed.h>
DigitalOut greenLED(PD_12);
DigitalOut orangeLED(PD_13);
DigitalOut redLED(PD_14);
DigitalOut blueLED(PD_15);
int main() {
while(1) {
// 按顺序循环 LED
// 注意:你可以使用以下命令切换 LED
// blueLED = !blueLED;
blueLED = 0;
greenLED = 1;
wait(0.25);
greenLED = 0;
orangeLED = 1;
wait(0.25);
orangeLED = 0;
redLED = 1;
wait(0.25);
redLED = 0;
blueLED = 1;
wait(0.25);
}
}Check out similar posts by category:
Mbed, PlatformIO
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow