boolean pushButton1;boolean pushButton2;void setup() {// put your setup code here, to run once:pinMode(2,INPUT_PULLUP);pinMode(8,INPUT_PULLUP);pinMode(13,OUTPUT);}void loop() {// put your main code here, to run repeatedly:pushButton1 = digitalRead(2);pushButton2 = digitalRead(8);if (!pushButton1&& !pushButton2) { //if pushButton==1,btn is not pusheddigitalWrite(13,HIGH);} else {digitalWrite(13,LOW);}}`
只有同时按下两个按钮,灯才会亮