SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By FoG
#196851
Yes, in advance I am a total noob, and I have tried to find this information already. My goal is to replace a single pole double throw switch with a temporary push button circuit. Press once to toggle from one option or the other (also intend to put dual color LED in to show what option is selected). If there is a resource that could help me figure out how this is supposed to work, I would greatly appreciate a point in that direction.

Many thanks in advance,
FoG
By theropod
#196861
Hey,

If you are planning on driving this application with an Arduino it is a simple thing.

Your code should look to turn on an output pin when the first button push is enacted. When the second button push is encountered that pin is turned off and a second output pin is activated. The loop would constantly be “looking” for that pushbutton input. You would probably be best served to drive those output pins by using the analog input pins. A couple “if-else” condition statements should take care of your needs.

Basically what you would be doing is creating a software (sketch) environment to emulate a latching relay. If you are not interested in using an Arduino a latching relay could be used, but could be more power hungry and rely on mechanical means to achieve your goal.

Make sense?
By lyndon
#196884
Simplest way is to use a 4017 counter with the pushbutton on the Clock input and your LED on the Output 0 output. Connect RESET to ground and Enable to +5V. Each button press toggles Output 0 on and off.
By theropod
#196890
Excellent use of the decade counter!

I think the OP wanted a single push button to select one of two conditions, unless I read it wrong. This would just require two output pins from the 4017, with self reset enabled, and use the pulse to the counter from the push button to toggle back and forth between option “A” or option “B” driven by the counter (and drive components for larger loads).

Hmm, multiplexing input to Arduino! Hadn’t even thought of using these devices as external inputs. Variable frequency inverter driver?