Support Additional Peripherals Using Custom Arduino Libraries
R2026bA custom Arduino® library is a communication interface between custom C++ code executed on the Arduino hardware and MATLAB® code executed on your development computer.
With custom Arduino libraries, you can access additional features of an Arduino directly from the MATLAB command line by including the libraries when creating an arduino connection object. For an
example of a custom Arduino library, see Control Motors Using Adafruit Motor Shield V2.
The MATLAB Support Package for Arduino Hardware provides you with a framework of classes that you can use to create custom Arduino libraries to use with your Arduino device and attached hardware shields. The support package provides classes and functions to help you develop a custom Arduino library, collectively referred to as the custom Arduino library framework.
You can create a custom library using one of the following workflows:
Create and configure the custom Arduino library package folder, MATLAB class, and C++ header files. Follow the steps in Create Custom Arduino Library or watch Create a Custom Arduino Library Manually.
Use the function
arduinoio.customLibrary.createLibraryTemplateto generate a starter custom Arduino library that includes the required folder structure, MATLAB class, and C++ header file. You can then modify the generated template to implement custom functionalities.
Before you start, see Custom Arduino Library Concepts.
Classes
matlabshared.addon.LibraryBase | Abstract class for deriving custom Arduino libraries |
Functions
Topics
Getting Started
- 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 Hardware Resources and Pin Diagram
- 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.
Additional Information
- 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.