- Install MATLAB Support Package for Arduino Hardware
- Execute >> arduinosetup and follow the screens for ESP32
- Download the Neo pixel MATLAB addon from the following link and install https://in.mathworks.com/matlabcentral/fileexchange/72707-neopixel-add-on-library-for-arduino.
- Downlaod the Neo pixel library from the following link, https://github.com/adafruit/Adafruit_NeoPixel/archive/v1.1.2.zip
- Unpackage the zip into local directory and rename the folder to ‘Adafruit_NeoPixel'.
- Move the ‘Adafruit_NeoPixel’ folder into the "libraries" folder inside your Arduino libraries folder, see https://in.mathworks.com/matlabcentral/fileexchange/72707-neopixel-add-on-library-for-arduino for libraries folder info
- Execute
Arduino Support PKG: Arduino CLI build command fails in 2024a when using addOnLibraries
18 views (last 30 days)
Show older comments
I'm trying to use the Mathworks neoPixel libraries on my ESP32 and I'm hitting a snag when compiling the arduino server using Utility.buildServer in MATLAB. I noticed that additional libraries are not imported into the Arduino sketch folder, instead MATLAB generates an addOnLibraries.h file that references any additional libraries you want to include. This seems to be the cause of the problem.
addOnLibraries.h
#include "Arduino.h"
#include "LibraryBase.h"
#include "MWArduinoClass.h"
#include "C:\Users\epran\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\NeoPixel Add-On Library for Arduino\+arduinoioaddons\+Adafruit\src\NeoPixel.h"
MWArduinoClass hwObject;
NeoPixel aNeoPixel(hwObject); // ID = 0
NeoPixel.h asks to include LibraryBase.h
NeoPixel.h
#include "LibraryBase.h"
#include "Adafruit_NeoPixel.h"
LibraryBase.h. is in the Arduino sketch folder, but this error happens:
2024a\\aCLI\\data\\packages\\esp32\\hardware\\esp32\\2.0.11\\variants\\esp32" "C:\\Users\\epran\\AppData\\Local\\Temp\\ArduinoServerESP32-WROOM-DevKitC\\MW\\sketch\\IO_addOn.cpp" -o nul
Alternatives for LibraryBase.h: []
ResolveLibrary(LibraryBase.h)
-> candidates: []
In file included from C:\Users\epran\AppData\Local\Temp\ArduinoServerESP32-WROOM-DevKitC\addOnLibraries.h:4,
from C:\Users\epran\AppData\Local\Temp\ArduinoServerESP32-WROOM-DevKitC\IO_addOn.cpp:12:
C:\Users\epran\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\NeoPixel Add-On Library for Arduino\+arduinoioaddons\+Adafruit\src\NeoPixel.h:10:10: fatal error: LibraryBase.h: No such file or directory
#include "LibraryBase.h"
^~~~~~~~~~~~~~~
compilation terminated.
Used platform Version Path
esp32:esp32 2.0.11 C:\ProgramData\MATLAB\SupportPackages\R2024a\aCLI\data\packages\esp32\hardware\esp32\2.0.11
Error during build: exit status 1
aCLI can't seem to connect the LibraryBase.h in the sketch folder to the LibraryBase.h that NeoPixel.h asks for.
I'm able to get it working in Platformio, and in Arduino IDE no problem when I pull the additional libraries into the main source folder and modify the additionalLibraries.h file accordingly.
Any suggestions or thoughts would be welcome :)
0 Comments
Answers (1)
MathWorks MATLAB Hardware Team
on 25 Sep 2024
Hi,
Here are the steps required to use ESP32 board with Neo Pixel addon,
>> listArduinoLibraries
ans =
12×1 cell array
{'APDS9960' }
{'Adafruit/MotorShieldV2'}
{'Adafruit/NeoPixel' }
{'CAN' }
{'I2C' }
{'MotorCarrier' }
{'RotaryEncoder' }
{'SPI' }
{'Serial' }
{'Servo' }
{'ShiftRegister' }
{'Ultrasonic' }
>> esp32 = arduino('COM21','ESP32-WROOM-DevKitC','Libraries',{'I2C','Adafruit/NeoPixel'},'Traceon', true,'ForceBuildOn',true)
esp32 =
arduino with properties:
Port: 'COM21'
Board: 'ESP32-WROOM-DevKitC'
AvailablePins: {'D0', 'D2', 'D4-D5', 'D12-D19', 'D21-D23', 'D25-D27', 'D32-D36', 'D39'}
AvailableDigitalPins: {'D0', 'D2', 'D4-D5', 'D12-D19', 'D21-D23', 'D25-D27', 'D32-D36', 'D39'}
AvailablePWMPins: {'D2', 'D4-D5', 'D12-D19', 'D21-D23', 'D25-D27', 'D32-D33'}
AvailableAnalogPins: {'D2', 'D4', 'D12-D15', 'D25-D27', 'D32-D36', 'D39'}
AvailableI2CBusIDs: [0]
AvailableSerialPortIDs: [2]
Libraries: {'Adafruit/NeoPixel', 'I2C'}
Show all properties
Thanks,
MATLAB Hardware Team
MathWorks
0 Comments
See Also
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!