- Posts: 915
- Thank you received: 216
Please Log in or Create an account to join the conversation.
robertspark wrote: thanks Andy, I can create the pins (all 112) no problem and change their status from true to false.
I am looking for is simple means to input keypresses into the MDI.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
andypugh wrote:
robertspark wrote: thanks Andy, I can create the pins (all 112) no problem and change their status from true to false.
It probably makes sense to read a config file, which is a list of rows and columns, and create HAL pins or keystrokes accordingly.
Something like:Which would create HAL pins called "coolant" and "run" and send a 44 key event (KEY_Z) for the third. And do nothing for the blanks or for rows/columns omitted.Code:r1c1 pin coolant r1c2 pin run r1c3 key 44 r1c4 r1c5 ...
Parsing in Python can be done with regexes, to parse the above format:Code:import re ... [row, column, type, val] = re.split("r(\d*)c(\d*) (.*?) (.*)", "r1c2 pin hello")[1:5]
I find this web site invaluable for experimenting with regexes: regexr.com
I am looking for is simple means to input keypresses into the MDI.
I think that python-evdev looks like the best way:
python-evdev.readthedocs.io/en/latest/
This seems a close match to the way that my sendkeys component does it in C.
The keycodes are here: wiki.linuxcnc.org/cgi-bin/wiki.pl?Scancodes
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.