Let's Make Robots!

Momentary push button to on/off switch?

Is there some way to make an on/off switch using a momentary push button? I think the buttons feel more natural. They are smaller too. Just wonderin'...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

You could make a start-stop schematic with two pushbuttons and a transistor. Or one with just one pusbutton, a PIC(axe) and a transistor. Code would be (assuming a picaxe):

b0=0
do
If pin1=1 then
b0=b0+1
Endif
If b0//2=0 then
high 1
Else
low 1
endif
while 1

I just noticed that my code (which I whilst alsmost sleeping at night) could be a lot easier:

do
if pin1=1 then
if output1=1 then
low 1
else
high 1
endif
endif
while 1

Actually, it's from Pololu, SF is a reseller in this case.