嵌入式技术
构建的路径的修改
确认连接脚本是否正确。
LED | 引脚 | RT-Thread Pin 编号 |
---|---|---|
LED_R 红色 | PB14 | GET_PIN(B, 14) |
LED_G 绿色 | PB0 | GET_PIN(B, 0) |
LED_Y 黄色 | PE1 | GET_PIN(E, 1) |
#include < rtthread.h >
#include < rtdevice.h >
#include < board.h >
/* defined the LEDR LEDG LEDY pins */
#define LEDR_PIN GET_PIN(B, 14)
#define LEDG_PIN GET_PIN(B, 0)
#define LEDY_PIN GET_PIN(E, 1)
int main(void)
{
int count = 1;
/* set LEDS pin mode to output */
rt_pin_mode(LEDR_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LEDG_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LEDY_PIN, PIN_MODE_OUTPUT);
rt_kprintf("hello, STM32H743 RT-Thread!\\r\\n");
while (count++)
{
rt_pin_write(LEDR_PIN, PIN_HIGH);
rt_pin_write(LEDG_PIN, PIN_HIGH);
rt_pin_write(LEDY_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LEDR_PIN, PIN_LOW);
rt_pin_write(LEDG_PIN, PIN_LOW);
rt_pin_write(LEDY_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
}
运行效果
全部0条评论
快来发表一下你的评论吧 !