필터 지우기
필터 지우기

Simulink raspberry pi keyboard read

조회 수: 4 (최근 30일)
Matt Griffith
Matt Griffith 2021년 9월 27일
답변: Pratyush 2024년 5월 21일
Hello all,
It seems like there is not a keyboard read simulink block provided by Mathworks for the Raspberry pi is that correct?
What would be the easiest way to get characters from a connected usb keyboard into a simulink program running on the pi?
Would a custom device driver be the best way to achomplish that?
Is there anything preventing a custom device driver from working?
Could someone point me at the best example to get keyboard input working?
Thank you very much,
Matt

답변 (1개)

Pratyush
Pratyush 2024년 5월 21일
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.

카테고리

Help CenterFile Exchange에서 Raspberry Pi Hardware에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by