# Simple LED circuit and program problem

Hello!

I made the circuit that is shown in the attached image.
I want to make (for now) a simple Arduino circuit where i have a 3-way switch and do the following:

• On position #1 of the switch , #1 LED lights up
• On position #2 of the switch , #2 LED lights up

The problem i have is when i run the program, arduino’s onboard LED’s all shut down and i get no response either , getting the message “Problem uploading to board”. The board disappears from Tools>Port.
If i unplug the 5Volt that powers the LED’s the boards comes back up.
I think the problem is in my circuit but i cant find where exactly.

Hardware used:
Arduino Uno board
2 Orange LED’s
2x500Ω Resistances for LED’s
2x500Ω Resistances for the switch’s outputs

Code:

``````int inPin1 = 2;      //input pin 1
int inPin2 = 3;      //input pin 2
int outPin1 = 13;    //output pin 1 (LED 1)
int outPin2 = 12;    //output pin 2 (LED 2)
int r1;              //integer for input 1 store
int r2;              //integer for input 2 store

void setup()
{
pinMode(inPin1, INPUT);
pinMode(inPin2, INPUT);
pinMode(outPin1, OUTPUT);
pinMode(outPin2, OUTPUT);
}

void loop()
{

if (r1 == HIGH && r2 == LOW)
{
outPin1 = HIGH;
outPin2 = LOW;
}
else if (r1 == LOW && r2 == HIGH)
{
outPin2 = HIGH;
outPin1 = LOW;
}
}
``````

Your test circuit only shows a two way switch. How does that work as a three-way switch?

Paul

If i unplug the 5Volt that powers the LED's the boards comes back up.

Your picture doesn't show a 5V connection to the LEDs.

...The only thing I can think of is that those resistors aren't 500 Ohms. If the resistance is too low you can get too much current and unpredictable things can happen. Do you have a multimeter to check them? With 500 Ohms in series nothing bad should happen, even if they are wired wrong.

And if I believe your picture, you don't show ground connections to the switch- resistors.

Its likely the actual hardware does not match the circuit of one of the hardware items is not what you think it is. Believe me, I've looked a malfunctioning hardware many times overlooking the obvious because in my mind I though I had previously verified that item, only to finally find it was wrong.

I would disconnect the LED's and Switch. See if the program loads. If so I would then connect one LED, then the other etc.

You need a ground wire to the top ground bus (blue row), at least.

You need a ground wire to the top ground bus (blue row), at least.

It's a 3 way switch 'cause it has 3 wires.

Biersuchtiger:
The problem i have is when i run the program, arduino's onboard LED's all shut down and i get no response either , getting the message "Problem uploading to board". The board disappears from Tools>Port.
If i unplug the 5Volt that powers the LED's the boards comes back up.
I think the problem is in my circuit but i cant find where exactly.

Unless I'm misreading the post it appears @Biersuchtiger cannot upload to the board. I assume this is from the Arduino IDE. And the process of trying to upload is causing something to lock up. Hence my suggestion to disconnect all hardware and retry uploading.

Perhaps I should have included the suggestion of trying to upload one of the LED blink examples just to verify the board and connection to the IDE.