need help with toggle switch

Hello

First i hope is okay to ask for some help here, i have never used a anduino before, but i rand in to a problem i was told it might could help me solve.

i making a button box to help control some software, the software can recognize a joystick. so i order a print board form the internet there is recognize as a joystick and just have 10 set of 2 paired pin there need shorting like a normal button.. works great but my problem is there some function there is on/off to you puss the same button to turn it on or off.
but the client would like to have a toggle switch(on/off model) so he can see if the is on or off.. can you program a arduino to shorten the 2 pin then is turn on and again then off..

i hope you understand i can try making a drawing if that will help..

A drawing would be a good start.
Also provide links to the components you have purchased including the switch/joystick and the Arduino.
If you have already written some code, include that as well.

You can get an SPST toggle and wire it up as a button. It will look like it stays up or down because it does, difference with the toggle is you don't have to hold it down like you would a button.

You will have to change the code for that button, no way around that. It looks for 2 ON/OFF to change mode, for the toggle it should only look for once. Not compatible.

Arduino Micro has a USB-AVR chip that can communicate to the PC as an HID (human interface device; stick, mouse, keyboard) easily.

I have only got the joy stick board from ebay.

have not gotten any arduino since i did not what to get.. i willing to use this board i have is i can do ti only with some arduino board.

the toggle i have is these: toogles

i simply need the toggle switch to sim press and release of E then flip to on. and again the flip back to off

WELCOME !
Glad you could join us !

please read ' how to use this forum'
it helps you to know the basics. like how to use a subject line that makes sense and has people know what you want.
the one you have cannot be of any use in a search.

That board as shown looks to be stand-alone, plug into a PC and works except I dunno if it does or will as the only comment is vague and very likely made by the maker to get the "what was promised" (damned little if you go looking for hard data on that page, success is NOT promised) standard set against any complaints. But that for $9, it should be able to work.

Where would you put an Arduino in that? You're just supposed to connect inputs to it and that's the product.

There are more than one type of switch.

a very common one is a switch that changes state. this is like a light switch. you push it one way and the lights go on, you push it the other way and the lights go off.

another common switch is a momentary. you push it, and as long as you are holding it, the circuit is complete.
this is like a doorbell, or tact switch as you show.

the lever switch you show can be purchased as a momentary, push and it will return to center.
The toggle switch you listed says it is on/off
The lever would be spring return to the center and only when you push and hold, it would close the circuit.
Most of you game controllers have this sort of switch in the joystick.

You can buy a mini pushbutton that is press one time and it closes the contact, then press again and it opens them.
If you put in an LED in series, then the LED would be lit when the circuit is closed and not lit when it is open.

You can take any type of switch and wire into an Arduino and then write a simple program to have the output do what you ask.

I assume that English is not your native language and I do not understand exactly how you want the switch to work.

Yes English it not my language.

The reason I use the on/off toggle there stays up the you turn it on it so they can feel it. With out having to look down to see if its on or off

Hope that helps you understand

If you use the toggle that stays were you put it, the switch will make contact and hold .
the board you have will see that the switch is closed until you move it the other way.

If that is your goal, then you do no need to use an Arduino.

I need to sendt i keypress and release the it's set on and again the off.
The board I have now holds the key down until it returns to off. That does the software not under stand.
You normal press and release e on the keyboard to start the drive. And again to stop it.

Sorry my English this bad.

You should tell the customer that the toggle switch is a hard thing to do.

To make a toggle look like a momentary button might only need a circuit.

Would it help if I used a on off on toggle.

you want to have a toggle
The position of the switch that shows the device is ON or OFF
you want the toggle to send a pulse when the position changes.

this will act like a momentary, but it will stay with the level up (or down)

a momentary (mom) off (mom)
the lever has a spring and returns to the center.

the Arduino switch could see the change, then send a pulse
when you put the switch down, it would see a change and send a pulse

the lever will be UP or DOWN

He needs the toggle that stays ON/OFF to control another switch/button.

The toggle switched to ON needs to close the switch/button for maybe 100 or 200 millis then open it (a short press and release).

The toggle switched to OFF should do -nothing- to the switch/button but ......

it could for example power an RC circuit that briefly (100 or 200 millis) )powers an opto-isolator (which is a switch) when flipped ON. So possibly a resistor, a capacitor and an opto-isolator could be wired to do this.

GoForSmoke:
He needs the toggle that stays ON/OFF to control another switch/button.

The toggle switched to ON needs to close the switch/button for maybe 100 or 200 millis then open it (a short press and release).

The toggle switched to OFF should do -nothing- to the switch/button but ......

it could for example power an RC circuit that briefly (100 or 200 millis) )powers an opto-isolator (which is a switch) when flipped ON. So possibly a resistor, a capacitor and an opto-isolator could be wired to do this.

I am thinking there are more than a few ways to get the desired result.
doing it in hardware is not as much fun as doing it with software, besides, in hardware, you don't get to play with an Arduino.

My concern is if you only get one pulse on a change, and the receiving end is dumb, there is no way to know if you switched up or down. a second input would solve that, but take up a second input. a pulsed train or long duration pulse could also indicate if the switch just went up or down.

i dont know if this is possible. but could you variable fx drive=on the you turn is on.. again then of.. i have not tried to program a arduino yet. i have just order a leonardo waiting on the post man do deliver it.. :slight_smile:

dave-in-nj:
I am thinking there are more than a few ways to get the desired result.
doing it in hardware is not as much fun as doing it with software, besides, in hardware, you don't get to play with an Arduino.

My concern is if you only get one pulse on a change, and the receiving end is dumb, there is no way to know if you switched up or down. a second input would solve that, but take up a second input. a pulsed train or long duration pulse could also indicate if the switch just went up or down.

You think software is fun now?

The setup I described would turn every toggle ON into a press and release (the opto switch closes then opens quickly while toggle OFF would not affect the switch but would charge the capacitor for the next toggle ON.