How to simulate a toggle switch

Working on my first Patch…so very new to XOD

I would like to simulate a toggle switch: when it is closed send 100 pulses clockwise to a 28BYJ-48 stepper motor then wait for a change in the switch state. When it is open send 100 pulses counter-clockwise to the stepper and again wait for a change in state. The switch input is on D1.

Sounds like you want to use flip-flop node for your toggle and flip-n-times to send the 100 pulses. State of flip-flop will control direction of rotation. flip-n-times restarts count every time button is pressed (flip-flop changes state).

Both puls… nodes are pulse-on-change.

1 Like

Thank you very much. Your implementation is much simpler than what I had started. I think much of my trouble was not knowing the various nodes. For testing I replaced the switch with a Tweak-Boolean followed by a pulse on change to the TGL input of the F-F. It works great and by adding a few watches I can see how it all works.

Thanks again.