Main Content

自定义 Arduino

为 Arduino® 创建自定义附加功能库

附加功能库是在 Arduino 硬件上执行的自定义 C++ 代码与在您的主机上执行的 MATLAB® 代码之间的通信接口。

使用附加功能库,最终用户可以在创建 arduino 连接对象时,通过包含库直接从 MATLAB 命令行访问 Arduino 的附加功能。有关附加功能库的示例,请参阅Control Motors Using Adafruit Motor Shield V2

MATLAB Support Package for Arduino Hardware 为您提供了一个类框架,您可以使用这个框架来创建自定义附加功能库,以便与您的 Arduino 设备和连接的硬件扩展板一起使用。此支持包提供了帮助您开发插件库的类和函数,统称为 Arduino 附加功能软件开发工具包 (SDK)。

开始之前,请参阅Custom Add-On Library Concepts

当您准备就绪,可以开始创建自己的插件库时,请按照 Create Custom Arduino Add-On Library 中的步骤操作,或观看创建自定义 Arduino 附加功能库

matlabshared.addon.LibraryBaseAbstract class for deriving Arduino add-on libraries

函数

sendCommandSend message to Arduino device from MATLAB
configurePinResourceSet resource owner and mode of pin
decrementResourceCountDecrement count of number of instances of resource
incrementResourceCountIncrement current resource count
getTerminalsFromPinsGet terminal numbers from pins
listArduinoLibrariesDisplay a list of installed Arduino libraries
getResourceCountNumber of instances of a resource
getFreeResourceSlotGet first free slot of resource
setSharedResourcePropertySet shared resource property
getSharedResourcePropertyGet shared resource property
getResourceOwnerGet terminal resource owner
validatePinValidate that pin supports specific functionality
getPinsFromTerminalsGet pin numbers from terminal
getTerminalModeGet current terminal mode
isTerminalDigitalCheck if terminal can be used as a digital pin
isTerminalAnalogCheck if terminal can be used as an analog pin
getServoTerminalsGet terminals that have servo functionality
getI2CTerminalsGet terminals with I2C functionality
getSPITerminalsGet terminals that have SPI functionality
getPWMTerminalsGet terminals with PWM functionality
getMCUGet microcontroller of Arduino board
getPinAliasGet alias pin number
getInterruptTerminalsGet terminals with interrupt functionality

主题

快速入门

Arduino 硬件资源和引脚图

其他信息