sfun_joystick.zip

版本 1.1.0.0 (15.0 KB) 作者: Per Hillerborg
S-function to use a joystick in Simulink (Windows only)
744.0 次下载
更新时间 2014/10/17

查看许可证

/* File: sfun_joystick.c
* Description: sfun_joystick.c is a S-function (used in a S-function block)
* which reads joystick output into a simulink model. This
* S-function only works on windows computer but should be easy
* to port to other OS.
*
* Output: 1. Current X-coordinate.
* 2. Current Y-coordinate.
* 3. Current Z-coordinate.
* 4. First joystick button is pressed.
* 5. Second joystick button is pressed.
* 6. Third joystick button is pressed.
* 7. Fourth joystick button is pressed.
*
* Input: Joystick ID. Typically "0".
*
* Usage: First compile from Matlab command window:
* mex sfun_joystick.c -lWinmm
* A demo model called joystickDemo.slx (R2013b) is available.
*
* Author: Per Hillerborg,
* Version: 2.0, October 17, 2014, (Update from 1.0. Changed to INHERITED_SAMPLE_TIME so it is more plug and play)
*
* Note: This file can be edited to only send out wanted output.
* For more info see:
* http://msdn.microsoft.com/en-us/library/dd757110%28v=vs.85%29.aspx
*
* Further tips:If more buttons are preferred, use the JOYINFOEX instead of
* JOYINFO which contains extended info including more buttons.
*/

引用格式

Per Hillerborg (2025). sfun_joystick.zip (https://ww2.mathworks.cn/matlabcentral/fileexchange/47141-sfun_joystick-zip), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2013b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Prepare Model Inputs and Outputs 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.1.0.0

Update from 1.0: Changed to INHERITED_SAMPLE_TIME so it is more plug and play.

1.0.0.0