KEMBAR78
Ledpush Button Pr1ssjme | PDF
0% found this document useful (0 votes)
6 views3 pages

Ledpush Button Pr1ssjme

Uploaded by

Aditya Marsale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Ledpush Button Pr1ssjme

Uploaded by

Aditya Marsale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

#define LED1 10

#define LED2 11

#define LED3 12

#define LED4 13

#define button1 2

#define button2 3

#define button3 4

#define button4 5

void setup() {

// put your setup code here, to run once:

Serial.begin(9600);

Serial.println("press push-button switches SW2-SW5");

pinMode(LED1,OUTPUT);

pinMode(LED2,OUTPUT);

pinMode(LED3,OUTPUT);

pinMode(LED4,OUTPUT);

pinMode(button1,INPUT);

pinMode(button2,INPUT);

pinMode(button3,INPUT);

pinMode(button4,INPUT);

void loop() {

// put your main code here, to run repeatedly:

if(digitalRead(button1)== LOW)

Serial.println("SW2 pressed");

digitalWrite(LED1,HIGH);
delay(1000);

else

digitalWrite(LED1,LOW);

if(digitalRead(button2)== LOW)

Serial.println("SW3 pressed");

digitalWrite(LED2,HIGH);

delay(1000);

else

digitalWrite(LED2,LOW);

if(digitalRead(button3)== LOW)

Serial.println("SW4 pressed");

digitalWrite(LED3,HIGH);

delay(1000);

else

digitalWrite(LED3,LOW);

if(digitalRead(button4)== LOW)

Serial.println("SW5 pressed");

digitalWrite(LED4,HIGH);

delay(1000);

else

digitalWrite(LED4,LOW);
}

You might also like