想必現(xiàn)在有很多小伙伴對(duì)于key1與k1開(kāi)關(guān)區(qū)別方面的知識(shí)都比較想要了解,那么今天小好小編就為大家收集了一些關(guān)于key1與k1開(kāi)關(guān)區(qū)別方面的知識(shí)分享給大家,希望大家會(huì)喜歡哦。sbit Key1 = P0^1;sbit Key2 = P0^2;sbit Key3 = P0^3;sbit Key4 = P0^4;sbit LED = P2^0;#define ON 1#define OFF 0unsigned char flag;int main(void){ flag = OFF; while (1) { if ((Key1|Key2|Key3)&& (flag == OFF)) ///燈處于熄滅狀態(tài)時(shí) 任何按鍵可以點(diǎn)亮 {LED = 1; flag = ON; }else{ LED = 0; flag = OFF; } if (Key4 &&(flag == ON)) ///按下key4時(shí) 熄滅燈,且任何按鍵無(wú)法點(diǎn)亮燈 { LED = 0; flag = ON; } if (!Key4) ///松開(kāi) key4 可以燈可以重新被點(diǎn)亮 { flag = OFF; } }}你的描述不是很清楚,我按照我的理解寫(xiě)的。
本文到此結(jié)束,希望對(duì)大家有所幫助。