图片缩略图

遗留MATLAB和Simulink支金宝app持Arduino金宝app

version 1.14.0.0 (170 KB) by 詹坎
MATLAB类和Simulink模金宝app块用于与Arduino微控制器板通信

210 k下载

更新2016年4月19日

查看许可协议

编者按:受欢迎的文件201220132014201520162017201820192020

注意:这个解决方案(以前称为“Arduino IO包”)不再被支持。金宝app建议您使用由MathWorks开发并支持的Arduino支持包:金宝app

- Arduino金宝app硬件MATLAB支持包:读取、写入和分析来自Arduino传感器的数据
//www.tatmou.com/hardware-金宝appsupport/arduino-matlab.html

Si金宝appmuli金宝appnk Support Package for Arduino Hardware:开发独立运行在Arduino上的算法
//www.tatmou.com/hardware-金宝appsupport/arduino-金宝appsimulink.html

只有在以下情况之一为真时才使用此金宝app遗留支持:
-你正在使用MATLAB R2013b或更早(但不早于R2011a)。
-您需要Simulin金宝appk块,使您能够交互流输入和输出从您的Arduino
-您需要功能或块,使您能够交互读取或重置编码器
-您使用的是不支持的Arduino克金宝app隆,无法与官方包(例如ChipKit32)工作

示例用法:
------------------

%——连接到板子
一个= arduino(“COM9”)

%——指定引脚模式
a.pinMode(4、“输入”);
a.pinMode(13,“输出”);

%——数字i / o
a.digitalRead(4) %读取引脚4
a.digitalWrite(13,0) % write 0 to引脚13

%——模拟i / o
a.analogRead(5) %读取模拟引脚5
a.analogWrite(9,155) % write 155到模拟引脚9

%——串行端口
A.serial %获取串口
a.flush;%刷新PC的输入缓冲区
a.roundTrip(42) %发送42到arduino并返回

%,伺服系统
a.servoAttach (9);将伺服安装在销#9上
a.servoWrite (9100);%旋转伺服销#9到100度
val = a.servoRead (9);%读取销9上的伺服角度
a.servoDetach (9);从销#9上拆下伺服

%——编码器
在引脚3(引脚A)和2(引脚B)上附加编码器#0
. encoderread(0) %读取位置
a.encoderReset(0) % reset编码器0
a.encoderStatus;%获得所有三个编码器的状态
a.encoderDebounce(0,12) %设置debounce延迟为12 (~1.2ms)
a.encoderDetach (0);%分离编码器#0

%——adfruit电机屏蔽(带AFMotor库)
a.motorRun(4, 'forward') %向前运行电机
a.stepperStep(1, 'forward', 'double', 100);%移动步进电机

%——关闭会话
删除()

有关这个软件包的一些幻灯片和例子可以在这里找到:
//www.tatmou.com/matlabcentral/fileexchange/27843

最后,关于使用和故障排除的更详细信息可以在本次提交的readme.txt文件中找到。

引用作为

詹坎(2021)。遗留MATLAB和Simulink支金宝app持Arduino金宝app(//www.tatmou.com/matlabcentral/fileexchange/32374-legacy-matlab-and-金宝appsimu金宝applink-support-for-arduino), MATLAB中央文件交换。检索