Can you use matlab code within an Arduino sketch?

3 visualizaciones (últimos 30 días)
Liam Brennan
Liam Brennan el 13 de Abr. de 2021
Respondida: Walter Roberson el 13 de Abr. de 2021
Hello all,
Basically I wanna know if this is possible before moving forward. I want to create a tune within matlab that uses different frequiences and then use that tune and upload it to arduino and have that be called upon in the sketch. This tune would be for a piezo, and I would like to play a short tune a certain point within the sketch. Would this possibly or can you not upload a matlab sketch to arduino?

Respuestas (1)

Walter Roberson
Walter Roberson el 13 de Abr. de 2021
MATLAB code cannot be included in an arduino sketch.
With current releases, you can target MATLAB code to be deployed to Raspberry Pi, which essentially generates C (or C++) and compiles it to send to the Raspberry.
There is currently no equivalent support for Arduino.
You can use MATLAB Coder to generate C or C++ code for a subset of MATLAB, and put that together with the appropriate hooks to send to Arduino. However, this would be "generic" target; MATLAB Coder does not know anything specific about Arduino, so you lose a bunch of the hardware support.
If you embed the MATLAB Code within a Simulink MATLAB Function Block then you can create a Simulink project that you deploy to Arduino; Simulink has Arduino support, with Arduino-specific blocks.

Categorías

Más información sobre Arduino Hardware en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by