Hello Matt,
To get keyboard input into a Simulink program running on a Raspberry Pi, you can use these methods:
- Use a script (e.g., Python) to capture keyboard inputs and write them to a file or a server, which Simulink can access.
- Write an S-Function in MATLAB or C/C++ that reads keyboard events using Linux's input event interface.
- Use a MATLAB Function block to execute Python code that listens for keyboard inputs.
Creating a custom device driver is generally not necessary since the Linux kernel already supports USB keyboards. The main challenges include ensuring real-time performance and integrating external scripts with Simulink. Starting with a Python script to capture keyboard inputs and integrating it into Simulink through a MATLAB Function block or file polling is usually the easiest approach.