0% found this document useful (0 votes)
32 views2 pages

Ard 1

This code defines variables for two LEDs and three buttons as digital pins, sets the pin modes in setup, and blinks the LEDs in different patterns depending on which buttons are pressed in the main loop.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views2 pages

Ard 1

This code defines variables for two LEDs and three buttons as digital pins, sets the pin modes in setup, and blinks the LEDs in different patterns depending on which buttons are pressed in the main loop.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

int led1 = 12;

int led2 = 13;


int button1 = 1;
int button2 = 2;
int button3 = 3;

void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(button3, INPUT);
end==0;
}

void loop() {

int i2 = 0; int i3 = 0;
i2 = digitalRead(button2);
i3 = digitalRead(button3);

while (i2 == HIGH) {


digitalWrite(led1, HIGH);
delay (1000);
digitalWrite(led1, LOW);
delay (500);

digitalWrite(led1, HIGH);
delay (1000);
digitalWrite(led1, LOW);
delay (500);

digitalWrite(led1, HIGH);
delay (1000);
digitalWrite(led1, LOW);

digitalWrite(led2, HIGH);
delay (3000);
digitalWrite(led2, LOW);

while(i3 == HIGH) {
digitalWrite(led2, HIGH);
delay (3000);
digitalWrite(led2, LOW);

digitalWrite(led1, HIGH);
delay (1000);
digitalWrite(led1, LOW);
delay (500);

digitalWrite(led1, HIGH);
delay (1000);
digitalWrite(led1, LOW);
delay (500);

digitalWrite(led1, HIGH);
delay (1000);
digitalWrite(led1, LOW);
end;
}
} }

You might also like