摘要:以书面形式使用。 定义绿灯引脚,定义数据类型键销,定义输出键销,定义输入密钥,设置高级别并连续运行程序。
使用AB32VG1用RT -线程工作室编写。
#include #include“ board.h” int main(void){uint8_t green = rt_pin_get(“ pe.4”); 1“); // keypin rt_pin_mode(green,pin_mode_output); //将LED定义为输出rt_pin_mode(key,pin_mode_input_pullup)。 //将密钥定义为输入RT_PIN_WRITE(green,pin_high)。 //将LED设置为高功率平坦,但是(1){if(rt_pin_read(key)== 1){rt_pin_write(green,pin_low);} if(rt_pin_read(key)== 0) )} //循环应该在那里,以便该程序始终运行}}}
评论前必须登录!
注册