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.
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.