2 Buttons with 2 LEDs Doesn't Work

Hello everyone,

I'm a real Arduino beginner. Beside that I know basic programming. I tried to turn on 2 LEDs separately by separate 2 buttons. Here is how my code looks like:

int red = 5;
int blue = 3;
int buttonApin = 9;
int buttonBpin = 8;

void setup() 
{
  pinMode(blue, OUTPUT);
  pinMode(red, OUTPUT);
  pinMode(buttonApin, INPUT_PULLUP);  
  pinMode(buttonBpin, INPUT_PULLUP);  
}

void loop() 
{
  if (digitalRead(buttonApin) == LOW)
  {
    digitalWrite(red, HIGH);
    digitalWrite(blue, HIGH);
  }
  if (digitalRead(buttonBpin) == LOW)
  {
    digitalWrite(blue, HIGH);
    digitalWrite(red, LOW);
  }
}

I also attached my breadboard photo. The problem is blue LED doesn't work.

Regards,

Videou

Welcome.

Where is your image?

Show us a good schematic of your circuit.
Show us a good image of your wiring.
Give links to components.
Posting images:
https://forum.arduino.cc/index.php?topic=519037.0

See the Red and Blue power rails on the bread board.
These are split in the middle.

Add jumpers between the LHS and RHS.

You might be using the wrong terminals on the switch.
Use a DVM to prove the switch is connected correctly.

Also we cannot tell if the LEDs are installed properly, you may have to turn them 180°

Thank you @larryd. This is a real quick response.

You are right. They look like continuous but they are not. The red and blue lines split in the middle. Thank you very much again for your precious help. I was really angry about Arduino. Now I'm fine.

It would be nice to see the Arduino also.

Add RED and BLUE jumpers to your board.

.

You might be using the wrong terminals on the switch.
Use a DVM to prove the switch is connected correctly.

Also, we cannot tell if the LEDs are installed properly, you may have to turn them 180°.