int led1 = 2;
int led2 = 3;
int led3 = 4;
int led4 = 5;
int sw = 8;
void setup() {
// put your setup code here, to run once:
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(sw, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
ledOutput(LOW,HIGH,HIGH,LOW);
delay(500);
ledOutput(HIGH,LOW,LOW,HIGH);
delay(500);
}
void ledOutput (int ledVal1, int ledVal2, int ledVal3, int ledVal4) {
digitalWrite (led1,ledVal1);
digitalWrite (led2,ledVal2);
digitalWrite (led3,ledVal3);
digitalWrite (led4,ledVal4);
}
No comments:
Post a Comment