- 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
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Eric Prandovsky
el 19 de Sept. de 2024
Respondida: MathWorks MATLAB Hardware Team
el 25 de Sept. de 2024
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 comentarios
Respuestas (1)
MathWorks MATLAB Hardware Team
el 25 de Sept. de 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 comentarios
Ver también
Categorías
Más información sobre Modeling en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!