Two Arduinos with Two Simulink Model
32 views (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
Subhajyoti
on 13 Sep 2024 at 10:55
Edited: Subhajyoti
on 13 Sep 2024 at 10:55
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.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!