uint8_t r = rt_pin_get("PE.1");//定义R led 引脚
uint8_t b = rt_pin_get("PA.1");//定义b led 引脚
uint8_t g = rt_pin_get("PE.4");//定义g led 引脚
rt_pin_mode(r, PIN_MODE_OUTPUT);//设置GPIO输出模式
rt_pin_mode(b, PIN_MODE_OUTPUT);
rt_pin_mode(g, PIN_MODE_OUTPUT);
rt_kprintf("Hello, worldn");
while (1)//循环
{
rt_pin_write(r, PIN_LOW);//r led引脚拉低 灯亮
rt_pin_write(g, PIN_HIGH);//g led引脚拉高 灯灭
rt_pin_write(b, PIN_HIGH);//b led引脚拉高 灯灭
rt_thread_mdelay(500);
rt_pin_write(g, PIN_LOW);
rt_pin_write(r, PIN_HIGH);
rt_pin_write(b, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(b, PIN_LOW);
rt_pin_write(r, PIN_HIGH);
rt_pin_write(g, PIN_HIGH);
rt_thread_mdelay(500);
}
5.编译文件
点击工具栏的
VID_20211015_201304