⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 switch_wait.c

📁 这是个用C语言写的单片机程序
💻 C
字号:
#include "main.h"
#include "port.h"
#include "switch_wait.h"
#include "delay_loop.h"
void switch_init()
{
 Q1_pin=1;//读段口1的第临危

}
bit switch_get_input(const tByte de)
{
  bit re_v=switch_not_pressed;
  if(Q1_pin==0)
  {
     delay_loop_wait(de);
     if(Q1_pin==0)	 ///******关键****///
      {
        while(Q1_pin==0);//***关键*千万小心不要把下面的话放在WHILE中///
	    re_v=switch_pressed;//因为WHILE只在空等,如果放进了它就不断的把一
	    //写入地三口
	  }
    }
	return re_v; //小心啊
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -