int a[4]={8,9,10,11};
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(4, INPUT_PULLUP);
//內部虛擬電阻
for(int x=8;x<=11;x++){
pinMode(a[x], OUTPUT);
}
}
void loop() {
// put your main code here, to run repeatedly:
int value =digitalRead(4);
if(value == 0){
for(int x=0;x<=3;x++){
for(int y=8;y<=11;y++){
digitalWrite(a[y], HIGH);
delay(500);
digitalWrite(a[y], LOW);
delay(500);
}
}
}
Serial.println(value);
}