Two Arduinos with Two Simulink Model

2 Ansichten (letzte 30 Tage)
Min
Min am 12 Sep. 2024
Kommentiert: Min am 13 Sep. 2024
Hi,
Please let me know if I am doing something wrong or it is just the limit of Matlab.
I have 2 Arduinos, Uno and Due.
I created two different Simulink model that 1, Uno, is going to be the output as sending digital signal. The second model is going to be the Due as an input to read what is on the pin.
When I open them both, set the Hardware, set the comport, and ran. Only one of them runs not the other.
Once one of them runs then the another Simulink model thinks that it needs to be connected to the currently connected device.
For example, if I run the Uno model, then the Simulink model (A) connects to Uno successfully. However, while the Due is connected, run the Due Simulink model (B) then it shows me an error saying that sorry I can't connect to Uno. I told the Simulink to connect to Due at a specific port but it is keep doing this.
Has anyone have experience in setting two arduinos and two simulink model separatly?
Thanks!

Akzeptierte Antwort

Subhajyoti
Subhajyoti am 13 Sep. 2024
Bearbeitet: Subhajyoti am 13 Sep. 2024
Hi @Min,
It is my understanding that you are trying to connect the Arduino ‘Uno’ and ‘Due’ serially to send data from one to other.
Currently, MATLAB has limited supported hardware for serialized data transmission across Arduino boards. The Arduino ‘Uno’ board in not supported for serialized Arduino Hardware connection.
As a workaround, you can try running the models sequentially, instead of simultaneously, i.e. first run the model for ‘Uno’, then run the model for ‘Due’ after disconnecting the previous one. This approach avoids the conflict between two models trying to access the same resources.
The following documentation has explanation and examples of ‘Send and Receive Serial Data Using Arduino Hardware’, with a list of supported Arduino Hardwares in Simulink:
I hope this helps.
  1 Kommentar
Min
Min am 13 Sep. 2024
Unfortunately, I need both of them running at the same time since I am trying to use them as an I/O. I guess I will try to use the Matlab app designer and assign value as it is not via Simulink. Thanks for the info!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by