int PinButton1 = 2;
int PinButton2 = 3;
int PinButton3 = 4;
int PinLed1 = 9; //red
int PinLed2 = 10; //yellow
int PinLed3 = 11; //green
void setup()
{
pinMode(PinButton1, INPUT);
digitalWrite(PinButton1, HIGH); // turn on pull-up !!
pinMode(PinButton2, INPUT);
digitalWrite(PinButton2, HIGH); // turn on pull-up !!
pinMode(PinButton3, INPUT);
digitalWrite(PinButton3, HIGH); // turn on pull-up !!
pinMode(PinLed1, OUTPUT);
pinMode(PinLed2, OUTPUT);
pinMode(PinLed3, OUTPUT);
}
void loop()
{
if(digitalRead(PinButton1) == LOW){
digitalWrite(PinLed1, HIGH);
}
else{
digitalWrite(PinLed1, LOW);
}
//2
{
if(digitalRead(PinButton2) == LOW){
digitalWrite(PinLed2, HIGH);
}
else{
digitalWrite(PinLed2, LOW);
}
//3
{
if(digitalRead(PinButton3) == LOW){
digitalWrite(PinLed3, HIGH);
}
else{
digitalWrite(PinLed3, LOW);
}
}}}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
$abcdeabcde151015202530354045505560fghijfghij
r2:1
r2:2
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r
btn3:1.l
btn3:2.l
btn3:1.r
btn3:2.r
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
r1:1
r1:2
r3:1
r3:2