Can I send a momentary pulse as a switch is toggled to off?

I admit to being a novice - please bear with me.
I have built a fairly complex sim game control panel which in itself is simple enough and it all works perfectly, with one exception:
I have a momentary toggle switch for which a single pinout is mapped to "Ignition" in the game - The game can only map a single pinout to ignition and relies on alternate closing of the switch to toggle on and off.
That presented a problem because I also have an LED which would only be on when the circuit was momentarily closed.
I successfully overcame that using a circuit with a pull-down resistor and some state detection code to latch the LED on alternate switch closure.
Here's the thing: I really want to use a maintained latching off-on toggle switch. That makes things simple with the LED, but not with interacting with the game to turn the ignition off.
Is there a way of sending a pulse (to mimic a button push from this one output pin) as the switch is closed, without affecting the LED state?
I fear that this involves some circuitry (possibly using 555 timer IC) above my pay grade, as well as code, but just maybe it's simpler than i think.
Many thanks if anyone is able to shed some light on this.

It sounds plausible enough to do in code. I assume that the switch isn't wired to the LED so you can set it independently.

One problem, the switch position and the received state have to be in sync. You send a pulse whenever the switch turns on - the receiving device also requires a pulse to turn off, no? Consecutive pulses turn it on/off/on/off...? So your fixed toggle must send a pulse when it is turned off as well. Therefore, the receiving device can not really know the actual state of the switch. It depends on the receiving device assuming that the physical switch is in some known position at boot time.

@wildbill
Yes, the LED is wired to the switch (well, at least it is to the current momentary switch).
In terms of what I am trying to achieve with a maintaining switch, I guess I can connect the LED to a separate pin and use code to set the LED pin to high or low, if it helped.

Then you just need to monitor the switch and when it changes, send a pulse to the game. It sounds like the LED should reflect the state of the toggle and you have that in place already.

@anon57585045
Yes correct on your questions/assumptions. That's why I can't wrap my head around it.
In terms of my configuration to latch the LED with the momentary switch, the board knows that the state is low on boot and the game knows the ignition is off at boot. So the board is basing its state detection on push count, and i assume the game is too..

Let's "set the stage". You have a toggle switch and a LED, attached to an Arduino. Also an output signal going to the game interface. You just need to implement the suggestion in reply #5. Do you understand it? Do you have some specific problem implementing it? Here is some pseudocode:

loop
{
  read switch
  if current switch value is not the same as the saved switch value
  {
  toggle LED
  send a pulse to the game
  set saved switch value to current switch value
  }
}

Considering the sync problem, there is nothing to "get your head around". You can't fix that without additional communication - either the game has to have access to the true switch position, or the switch has to have access to the game position. Also, a physical toggle can't be modified by software, it's position is determined by physics. So make sure that your pulses work well.

@wildbill and @anon57585045

Thank you Guys,
I'm not in front of it but will look at the code later. Somebody I know had tried to convince me that I would need extra circuitry, which is why I hadn't focussed on the code sufficiently before crying for help.
Appreciate your assistance and will confirm the outcome.

If this is the case, I can't imagine any additional circuitry that could help. You would need to modify the game itself.

@anon57585045

It really was that simple.... Simple LED circuit from pin (4) controlled by the SPDT toggle switch. Game ignition is mapped to another pin (7), which sends a 500ms pulse to the game when the pin 4 switch is opened or closed, based on switch state change detected by pin (2). Does exactly what I wanted it to.

Thanks for taking the time to reassure me of the right direction. I was just trying to overcomplicate things.

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