使用自定义 Arduino 库支持其他外设
R2026b自定义 Arduino® 库是在 Arduino 硬件上执行的自定义 C++ 代码与在您的开发计算机上执行的 MATLAB® 代码之间的通信接口。
使用自定义 Arduino 库,您可以在创建 arduino 连接对象时,通过包含库直接从 MATLAB 命令行访问 Arduino 的附加功能。有关自定义 Arduino 库的示例,请参阅Control Motors Using Adafruit Motor Shield V2。
MATLAB Support Package for Arduino Hardware 为您提供了一个类框架,您可以使用这个框架来创建自定义 Arduino 库,以便与您的 Arduino 设备和连接的硬件扩展板一起使用。该支持包提供类和函数,帮助您开发自定义 Arduino 库,统称为自定义 Arduino 库框架。
您可以使用以下工作流之一创建一个自定义库:
创建并配置自定义 Arduino 库程序包文件夹、MATLAB 类和 C++ 头文件。按照Create Custom Arduino Library中的步骤操作,或观看手动创建自定义 Arduino 库。
使用
arduinoio.customLibrary.createLibraryTemplate函数生成一个入门级自定义 Arduino 库,其中包含所需的文件夹结构、MATLAB 类和 C++ 头文件。然后,您可以修改生成的模板以实现自定义功能。
开始之前,请参阅Custom Arduino Library Concepts。
类
matlabshared.addon.LibraryBase | Abstract class for deriving custom Arduino libraries |
函数
主题
快速入门
- Custom Arduino Library Concepts
Understand the components and communication workflow of a custom Arduino library. - Create Custom Arduino Library
Access unsupported hardware and peripherals connected to Arduino boards by creating custom Arduino libraries that enable communication between MATLAB and Arduino hardware.
- Create Custom Arduino Library Using Template
Use thearduinoio.customLibrary.createLibraryTemplatefunction to generate template files for a custom Arduino library. - Adapt Add-ons to New matlabshared.addon.LibraryBase Class
Learn how to configure your existing add-on class to the new matlabshared.addon.LibraryBase class.
Arduino 硬件资源和引脚图
- Custom Arduino Library Resources
Manage hardware resources among custom Arduino libraries. - Physical Terminals and Pin Numbers
Understand the difference between terminal numbers and pin numbers on your Arduino board.
其他信息
- Send Data from Arduino to MATLAB Using Custom Library
Create your first custom Arduino library. - Enable Support for LCD Using Custom Arduino Library
Create a custom Arduino library for LCD support.