Arduino学习笔记——按键控制
int x = 0 ;void setup(){pinMode(8,INPUT);pinMode(4,OUTPUT);}void loop(){if(digitalRead(8) == LOW){delay(200);x = !x ;if(x ==1){digitalWrite(4, LOW);}else{ digitalWrite(4, HIGH);}}}
Arduino学习笔记——按键控制
int x = 0 ;void setup(){pinMode(8,INPUT);pinMode(4,OUTPUT);}void loop(){if(digitalRead(8) == LOW){delay(200);x = !x ;if(x ==1){digitalWrite(4, LOW);}else{ digitalWrite(4, HIGH);}}}