Leonardo & Rotary Encoder

Hi everyone. I am new to Arduinos. I bought a Leonardo. I am working on a CNC Vertical machining center. Upgrading its control. it has no option for a Manual Pulse Generator. Basically a rotary encoder when turned one way moves the axis one direction for and when turned the opposite direction moves the axis in the opposite direction. This can be done on a keyboard.

What I would like to do, is get a rotary switch with 4 inputs. one position for each axis. Feed those into Leonardo. Connect the manual pulse generator, which uses +5V and outputs A, B, /A, /B. I don't think I have to use /A or/B. So for example when rotary switch is on position X, when the rotary encoder is turned in one direction Leonardo will out put say a right arrow key press for each pulse to the right. When the encoder is turned to the left, Leonardo will give a left arrow key press for each pulse from the encoder. Same with position 2,3,4 of the input switch, Leonardo outputs keypress that would move Y, Z and A axis.

Hoping someone hear has done it or can write the code and the suggested input connections.
Thanks in advance,
Marty
Mesa, AZ

Wow, no suggestions? Impossible? :roll_eyes:

Getting the Leonardo to read the encoder seems pretty straight-forward.

Getting the Leonardo to read the rotary switch seems pretty straight-forward.

Getting the Leonardo to act as a keyboard seems pretty straight-forward.

What is the hard part? What have you tried? Does the pulse generator actually expect keyboard input, or is the keyboard input going to a PC that is going to drive the pulse generator?

I appreciate the reply. My issue is that I am new to Arduinos. I knew a micro controller might do what I needed it to. I read up on Arduinos and found Leonardo to be a good keyboard emulator. I'm almost done with converting the control on my Dyna DM4400 vertical machining center, but it does not support a Manual Pulse Generator. There are keyboard short cuts to jog the axis. So what I wanted to do is have a 4 position switch tied to 4 inputs on Leonardo. When anyone of the inputs is asserted, and when the handwheel (quadrature 100pulse per rev encoder) each pulse would emulate a keyboard key press.

If there are examples that have been done, please point me in the right direction. I need to know which inputs to tie the 4 axis inputs to and the inputs of the Manual Pulse Generator. And of course writing the code for Leonardo.

Thanks again,
Marty
Mesa, AZ