I have a Revolution Pi system that I would like to use a USB Joystick with to control a robot. It is a standard HID device that I can read with jstest. I have been testing with a PS4 controller for now, with the correct drivers installed.
What would be the best way to interface that with CODESYS? I have seen a few other people asking similar questions on the forum, but I haven't seen any resolutions posted.
Thanks in advance!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have a Revolution Pi system that I would like to use a USB Joystick with to control a robot. It is a standard HID device that I can read with jstest. I have been testing with a PS4 controller for now, with the correct drivers installed.
What would be the best way to interface that with CODESYS? I have seen a few other people asking similar questions on the forum, but I haven't seen any resolutions posted.
Thanks in advance!
I'm not sure it will work, but you could try it with the CmpCharDevice library.
You could create a function block that looks something like this:
As input for the filename, you have to use your Linux device, e.g.:
'/dev/input/event0'
'/dev/input/by-path/platform-button@23-event'
Off course you must also pass the pointer to the memory where the data can be written to and the size (count in number of bytes) of the buffer.
Make sure you close the connection properly, maybe by overwriting the default FB_Exit method of the FB: