STM32简易交通灯设计定时可调.docVIP

  • 29
  • 0
  • 约1.85千字
  • 约 8页
  • 2020-08-16 发布于浙江
  • 举报
STM32简易交通灯设计(定时可调) //按键key1 设置红灯时间 按键key2 设置绿灯时间 按键key3设置黄灯时间 #include ; #include quot;sys.hquot; #include quot;delay.hquot; #include quot;usart.hquot; #include quot;stdlib.hquot; static int G=0,R=0,Y=0; //设置绿,红,黄灯时间变量 #include quot;lcd.hquot; #include quot;key.hquot; #include quot;time.hquot; //----------- 按键函数---------- void scan_key1() { static u8 i,j; if(key1==0) { if(i==0) { j++; if(j;3) { i=1;j=0; R++; if(R;20)R=0; printf(quot;key1 is inputed \r\nquot;); } } } else { i=j=0; } } void scan_key2() { static u8 i,j; if(key2==0) { if(i==0) { j++; if(j;3) { i=1;j=0; G++; i

文档评论(0)

1亿VIP精品文档

相关文档