M5Unified Add-On Library for Arduino

Connects MATLAB to M5Stack hardware using the Arduino M5Unified Library.
116 téléchargements
Mise à jour 4 nov. 2024

Afficher la licence

M5Stack support for MATLAB
Connect to an M5Stack ESP32 based device using the MATLAB Support Package for Arduino hardware. This Custom Arduino Add-On Library allows you to communicate with the integrated peripherals on M5Stack(IMU,LCD,MIC,PMU,SPKR,etc.) using the M5Unified & M5GFX Arduino Libraries.
M5Core2
To get started, you need:
  1. MATLAB.
  2. ESP32 based M5Stack (Core, Core2, Stick, Stick2,Atom).
  3. MATLAB Support Package for Arduino hardware.
  4. M5Unified & M5GFX Arduino Libraries installed in the arduino libraries folder.
  5. M5Unified Add-On Library for Arduino (this).
Connecting to the M5Stack
Once the environment is set up, we will create two objects in our workspace.
  1. An 'arduino' object that represents the ESP32 microcontroller .
  2. An 'addon' object that represents the M5Unified Libraries & the devices M5Unified controls.
First: Initialize communication with the ESP32 inside the M5Stack.
Example:
esp32 = arduino('COM6','ESP32-WROOM-DevKitC','Libraries',{'I2C','M5Stack/M5Unified'});
Second: Initialize the M5Unified Arduino Add-On Library.
Example:
M5Unified = addon(esp32,'M5Stack/M5Unified');
Controlling the M5Stack
Use the 'arduino' object namespace to communicate with the ESP32.
Example:
esp32.writeDigitalPin('D32',0);
esp32.readVoltage('D33');
Use the 'addon' object namespace to communicate with the M5Stack components.
Example:
M5Unified.lcdPrint('Hello');
Notes
  • This Library is in active development and more features will be added over time.
  • Created using MATLAB 2024a, it likely works with any version of the arduino support packages that supports ESP32.
  • Developed using the M5 Core2 for AWS, and some testing with the M5 StickC has been done.

Citation pour cette source

Eric Prandovsky (2024). M5Unified Add-On Library for Arduino (https://www.mathworks.com/matlabcentral/fileexchange/174055-m5unified-add-on-library-for-arduino), MATLAB Central File Exchange. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R2024a
Compatible avec les versions R2024a et ultérieures
Plateformes compatibles
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version
0.4.9.1

Accidentally included the 'resources' folder in 0.4.9. That folder is automatically added by File Exchange, this caused an install error.

0.4.9

Improvements to Speaker volume control functions(GL). Even better commenting showing usage(GL). Displaying .png files under now 720bytes works(EP). .m file Command ID's now defined properties(EP).

0.4.7

- powerOff() calls M5UnifiedDelete() & clears the arduino & m5unified objects
- For many drawing functions 'varargin' replaced with 'color' to improve readability
- Comment formatting by Greatlove to improve help
- Arduino Libraries printed to LCD

0.4.6

- M5.begin() is now called in setup() of the .h file. This allows us to print a welcome message on the LCD immediately without having to initialize anything in MATLAB.
- Also changed the folder structure from /title/title/src to /title/src

0.4.5

Added example Connect to M5Stack scripts.
Added a Utilities and Examples folders.
Utilities has a prepareForM5 script to automate library install and also help setup the MATLAB environment for esp32.
Examples has a chessboard example.

0.1