Main Content

Create Custom Arduino Library

R2026b

The custom Arduino® library framework enables you to create libraries that execute code on Arduino hardware from MATLAB®.

The framework takes care of the communication and interaction between MATLAB and an Arduino device, enabling you to focus on developing a particular feature. A custom Arduino library has three components:

You can use arduinoio.customLibrary.createLibraryTemplate to generate the folder structure, MATLAB class file, and C++ header file for your custom Arduino library. You can then modify the generated template based on your requirements. For more information, see Create Custom Arduino Library Using Template.

You can also create the folder structure, MATLAB class file, and C++ header file manually using the steps in this table.

StepsActionMore Information
1Create custom Arduino library folder package and add subfolders to contain C++ header file and MATLAB classCreate Custom Arduino Library Package Folder
2Create and configure C++ header file and add third part resources (if required) for custom libraryCreate and Configure C++ Header File
3Create and configure MATLAB custom Arduino library class that inherits from matlabshared.addon.LibraryBase. Create and Configure MATLAB Custom Arduino Library Class
Adapt Add-ons to New matlabshared.addon.LibraryBase Class
4Register custom Arduino library and run MATLAB codeRegister Custom Arduino Library

See Also

|

Topics