Conecting switch (DPDT ) with LED to arduino pro micro on matrix

I want to make a control panel to my fligth sim and need to connect an LED to an on-on switch on matrix. I'm already using keypad.h library and I'm using arduino pro micro.

How do i shold soldering it to have the LED with bright

this is the On-On switch that i have.

image

1 Like

This looks to me very similar to your other topic about a rocker switch.

?

In this topic the main question is how do i connect the led to the switch in order to he only turn on when i turn on the switch. I forget to say that the on-on switch will work like an on-off switch

Since it is an on-on switch there is no center off. No problem, simply use the center lead and one of the side leads as as your switch connections. If you pick the wrong side lead it will still work just switching in the reverse direction.

Yes, but i dont no who do i wire the LED to work with switch, without extra code

Can you light the led from the battery? - Just add a switch to break any of the wires coming from the battery to the led, connecting the wires as @gilshultz said.

Since the switch is in a matrix, I don't think you can use the switch itself to turn the LED on/off. It is possible to share some of the scanning pins for a switch matrix with an LED matrix, but that requires a few additional pins and some coding (as an example, you can use the row pins for both the switch matrix and an LED matrix, with separate column pins for each matrix).

I do not think it can be done with this type of switch.

I think it could be done with extra pins and extra code. (EDIT: @david_2018 post agrees)

It would be possible without extra Arduino pins and code if a DPDT switch was used, like this one.


One set of contacts could be part of the matrix. The other contacts could control the LED.

I have some of that switchs, but i never know how to use it. That type of switch will work in matrix.
If yes how do i wiring it?

2 Likes

Thanks for the scheme, but what is that?, the resistance and the diode will connect to ground right?

image

The LED will be connected in series with the resistor and between ground and Vcc so it will light up.

The circled items are little arrows that represent light and therefore the diode plus arrows of light symbol is interpreted to stand for an LED.

a7

I try and it work, thaks all.

NOTE:

the row nº need an diode to matrix work

and

if you use multiple led's you only need one diode and resistance to each col

Good to hear that.

But the rest of your post makes no sense. So it is hard to be sure, but some of it may be incorrect.

Your diagram seems to show a diode in series with the LED and resistor. That is not required at all. One resistor is needed for every LED, not one per column.

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