int led1Pin = 4;
int led2Pin = 5;
void setup() {
// we will use two pins for two LEDs
pinMode(led1Pin, OUTPUT);
pinMode(led2Pin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
setPin1(HIGH);
setPin1(LOW);
}
void setPin1(int led1){
digitalWrite(led1Pin, led1); //set pin 4 to output LOW or HIGH voltage
if(led1 == HIGH){
digitalWrite(led2Pin, LOW); // if pin 4 is outputting HIGH voltage, pin 5 should output LOW
}else{
digitalWrite(led2Pin, HIGH); // otherwise pin 5 should output HIGH
}
delay(1000); // delay of 1000 ms
}