Can I use a 3 pin switch connected to ground and 5v as an ON/OFF switch

3pin slide switch wired to a microcontroller with middle pin to ground and either side to vcc. Would this work as an on off/ reset switch or is this dangerous. Is there any other way to make an on/off switch?

no - an off/off switch as in either position it would shorrt out the supply.

Is there a way to make an on-off switch using a button or slide switch?

Yes. You need to identify the connections to the switch so you know which ones to connect to.

For example, your 3 pin slide switch may have the pins designated NO (normally open), NC (normally closed) and C or COM (common).

You should be able to determine which pin is which with a simple continuity test using a multimeter.

With a button, you need to figure out if it is a momentary button or a latching button.

image

The source is the microcontroller and the output would be what I code to do? Is this correct?

I would like the switch to turn on and off the project just like how the on/off switch for a phone works. Any ideas?

It's become more obvious now that you don't want a simple on/off switch.

Sorry if I didn’t explain my problem too clearly. This was the simplest I could explain my problem at the time. My apologies

@imprevii & @imprevi why 2 usernames?

The original post was made on my laptop and this account is on my phone. Apparently I made two accounts with the same username so I didn’t bother changing out of this.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.