Matrix Keyboard controlling LinuxCNC

More
17 Sep 2023 13:03 #281003 by AlexMagToast
Ah yes, so when you press a button, it also sends M(number of Key):(State).
It is a bit confusing, sorry. It uses the same Letter, but is different Signal, but good to see, it working.

I've changed the code again. Now it works on my test setup without flickering.

Please Log in or Create an account to join the conversation.

More
17 Sep 2023 13:33 #281006 by panming
The LED and the keys can work normally, the only problem is that the numbers do not correspond, although it does not affect the use, but I think it will be very confusing when installing the machine, if you are free, can you help me fix this bug? thanks.

Below is a numbered table.

 
Attachments:

Please Log in or Create an account to join the conversation.

More
17 Sep 2023 13:42 #281007 by AlexMagToast
so it works?

Yes i was expecting the numbers to be different.
I turned them by 90° to fit your setup.

Does it work with LinuxCNC too?
The following user(s) said Thank You: panming

Please Log in or Create an account to join the conversation.

More
17 Sep 2023 13:55 #281008 by panming
Yes, they all work, and when I type M:1, the first row and second column LEDs light up. When I pressed the buttons in the first row and second column, Arduino's serial debugging tool showed M8:1.

I haven't tried it on linuxcnc yet because I haven't figured out how to modify the py file, I'll try again tomorrow because I have to sleep, it's already 10:00 pm in China, and I have to go back to that damn job tomorrow.

Please Log in or Create an account to join the conversation.

More
17 Sep 2023 13:57 #281009 by AlexMagToast
ok see you soon.
Good night

Please Log in or Create an account to join the conversation.

More
18 Sep 2023 14:18 - 18 Sep 2023 14:19 #281077 by panming
Sorry, I'm having some problems, when I put py in PATH, modified the python version, and ran loadusr, it said No module named 'serial'.

I tried using “sudo apt-get install python-serial

but The package python-serial cannot be located

I also tried (sudo) pip(3) install pyserial

He told me I wasn't in a virtual environment and couldn't install

What should I do?Is there a problem with my source? I used Debian's mirror site in China, and my version of the system is a bookworm
Last edit: 18 Sep 2023 14:19 by panming.

Please Log in or Create an account to join the conversation.

More
18 Sep 2023 14:41 #281083 by panming
I solved it, the correct package name is python3-serial, which can be solved by installing linuxcnc-uspace-dev

Please Log in or Create an account to join the conversation.

More
18 Sep 2023 15:00 #281086 by panming
I don't know if I understand the program correctly, but I found that the names of the pins are in an array called CHARS, and the 56 keys mean that I have to use almost all capitals and lower case letters and numbers, which I think can be a bit confusing.

Please Log in or Create an account to join the conversation.

More
20 Sep 2023 07:58 - 20 Sep 2023 08:00 #281211 by AlexMagToast
Good to hear you got it working.

There are 2 Arrays you need to set up. Chars and Destination.
The Keyboard implementation is made to fit hopefully all kinds of matrix keyboard usecases. So there are 3 modes for each Key you can specify in the Destination array.
I think in your case you want to set it all to 0, this will create LinuxCNC hal pins for each key. You have to create 56 entrys with 0.

In Chars you can name your keys. As you want hal pins you can name them the key numbers aka ["0","1","2",......"54","55"] or something which helps you identify your key aka ["on","off","sp_left",sp_on","sp_right","sp_off", .... ] or whatever name you want to give your keys. Again you have to set 56 entrys. These will be used when creating the LinuxCNC hal pins by the software.
Last edit: 20 Sep 2023 08:00 by AlexMagToast.

Please Log in or Create an account to join the conversation.

More
21 Sep 2023 18:40 #281328 by AlexMagToast
any updates?
If it works, would you mind to record a Video for me, that i can use to showcase this functionality in the Documentation?

Please Log in or Create an account to join the conversation.

Time to create page: 0.089 seconds
Powered by Kunena Forum