I have a project where I want a 4 position rotary dip switch (BCD) type to turn on 4 LEDs. The switch will also be connected to 2 Arduino inputs, so I can tell which of the 4 positions is selected.
Switch Switch Pins
Position A B
1 0 0
2 1 0
3 0 1
4 1 1
Pretty simply binary stuff. I want to have 4 LEDs connected to the circuit but I only want one LED to be on at a time. For example, LED1 would come on when switch was in position 1 and the other 3 LEDs would be off. I am not using the Arduino to control the LEDs, I don't have enough I/O available. This is probably pretty easy with some logic circuits but I'm not familiar with designing anything like that. I'd appreciate any help.
The chip you are after is a (very common) 74HC139. It takes 2 inputs in a binary form and sets one of its outputs low accordingly. Connect each LED between an output and +5V with a suitable resistor each (anode to resistor to 5V, cathode to '139 output), and the switch outputs to th inputs. Connect the /G input to ground, and it should light each LED up for you in sequence.
I'll check out that chip. The problem with the circuit above is that in position 4 their would be power to switch pins 2 and 3. There is no pin 4 on the dip switch.
ScottG:
I'll check out that chip. The problem with the circuit above is that in position 4 their would be power to switch pins 2 and 3. There is no pin 4 on the dip switch.
The circuit above looks like it's for converting a standard 4-position switch into a 2-bit BCD switch - not what you're after.