Hello Guest it is December 02, 2020, 07:56:56 AM

Author Topic: Brains - Creating a button that sequences through various modes when pushed ?  (Read 4011 times)

0 Members and 1 Guest are viewing this topic.

I would imagine this is trivial for those that are familiar with creating brains (I'm not, complete newbie)

I'm making a hard button panel (see below), I'm using a Pokeys 57E to capture the key presses. This is working fine, I can jog, etc via the panel.  Setting this up using the pokeys configuration software (Mach3 plug-in) is straight forward, just map one of the 55 input pins to the desired button in mach3 and it works.

Some of the buttons on my panel need to cycle through various modes (bottom left button) for example the SS-CON-MPG. I have this mapped to button call 245 and it works fine, HOWEVER I would like a 4th press of the button to disable jogging, and then if I press again it starts at SS.

Similar situation for the right most blue button, first push MPG is set to Jog speed, 2nd push the MPG controls feed speed and then 3rd push disables the MPG.

Can someone describe how I can create a brain to provide this functionality?
I'm starting to get the impression that there are less people using "brains" that I envisioned.

The following almost works, it increments and selects, however I have not had any luck resetting OEMDRO: 1501 to 0 or 1 after I get to the desired roll-over count.  I have tried  MANY methods and they all failed. It seems like if you try to write to OEMDRO:1501 in any other rung after the initial instance that the register refuses to update or be set to 0, 1 etc.
« Last Edit: October 11, 2017, 09:19:36 PM by slow-poke »

I took another (simpler) approach and it works, I just need to add debounce to the inputs