In Flight Simulator one uses the keyboard to pass commands to the program. Pressing the "."-key (period) will activate the wheel brakes once you are on the tarmac; so this key has a unique function.
Pressing the "G"-key will result in retracting the landing gear. Pressing the same key again will let the landing gear down: this is what toggling means. The same key can lead to two different (and often opposite) results. Hereafter you will find a description on how to use switches (unique as well as toggle types) instead of keyboard keys: much more like the real thing !
In the beginning you will still need the keyboard as an interface to the computer. Once equipped with plenty of switches integrated in your homebuilt cockpit beauty you could even discard the key section of your keyboard. You just have to keep the printed circuit part.
How to use (and hack) a keyboard is discribed on various websites, and referred to in several places in the AVSIM-forum. A very goed one is Robers Prather's 777-project. Pressing a key essentially means that two crossing wires in the keyboard make contact; they are (almost) short-circuited. All the keyboard's wires end on a printed circuit. There you can solder (or plug in) your own wiring, parallel to the wires of the keyboard. You use these parallel wires for your switches.
The unique switch type (remember the wheelbrakes) is straightforward. Just use a push-type switch or button to connect the two wires associated with the period-key. The brakes will work as long as you push the button. In fact you just literally replace the keyboard key by an external one ...
There is more to tell about the toggle type switch, however. As an example let's take the strobe light switch, in Flight Simulator usually (de-)activated with the "O"-key. One could simply think of soldering the two wires associated with that key to a normal 'make-break' switch: connected in one position, disconnected in the other. Of course that would not do the job: once connected it would stay that way, causing the strobe light switch in the simulator to flip up and down endlessly… (that's probably how the first strobes worked ).
What we need is a short, temporary connection between the two wires whenever the switch is used, some kind of 'connection pulse'. This pulse has to occur every time the switch is activated, regardless whether the switch is moved upwards or downwards.
The job is done by a little circuit in which the actual connection between the two wires is established by a relay, see figure.
When the switch is connected to the 10 V the capacitor is charged within some milliseconds. The charge current is strong and long enough to activate the relay. Our alternative keyboard wires are connected briefly, imitating the required keystroke. Once charged the capacitor stops the current and ends our virtual keystroke.
When the switch is toggled the capacitor discharges and equally produces a 'connecting pulse'. Job done !
As generating pulses does require some energy (an electric current) we will need an external power source. At the same time we have to be very cautious not to impose external electric signals to the keyboard electronics. So using a relay insures a neat separation of power sources.
Questions left? Just let me know .