3 way switches are greater for directional control of pistons, but what do you do if you want to drive something digitally? A counter for example?
Here we can apply a similar principle to that which was used in mechanical mice. They used offset slots in a wheel, we’ll be using two offset magnets. The principle itself goes a little something like this….
Mount two magnets on a disc close together near the edge, and two switches, one above the other. Set the activation radius on both switches the same. Mount the disc with a motor and connect that to a 3 way switch set to direction. And thats about it. Here’s a Google SketchUp of the design.
Now, when you pull the switch, the motor spins and the switches will generate signals like this:-
The only problem this device has in it’s present form is that it is possible for both outputs to trigger one after the other if the player releases the switch at an in-opportune moment. We can however avoid this using some of the in-game mechanics of emitters (i.e. they cannot emmit into a space that is not empty).
Modifying the design to handle this situation gives us this:-
The sensors are the same but I’ve added some debounce functionality. The lime switch is set to 1 shot and hooked to the up emitter (all emitters have these settings:- Freq. 0.1s, Life ∞, Max. emitted at once 1, excet the reset emitter which has it’s life set to 0.1s), the yellow switch is also set to 1 shot and is hooked to the down emitter and finally, the purple switch is set to 1 shot and is hooked to the reset emitter.
The reset emitter emits a simple block with a green magnet attached and spawns into the space beneath it. The up and down emitters on the other hand emit slightly more complex blocks (also into the space beneath them). Made out of dissolving material, these have a magnet to operate the up (red) and down (blue) output switches along with a green on/off switch that is connected to the block itself.
So, they spawn, activate their corresponding output switch and then just sit there, blocking the other direction block, until the reset emitter is activated approximately half a turn of the motor later spawning a green reset block which disolves the up/down block.
And that’s it, a nice simple way to convert a 3 way switch into an up/down pulse generator.