How to address Rasperry Pi conection when usin Simulink in Connected IO mode?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
Normally, to connect the raspberry to Matlab/Simulink you need to use the raspi command, e.g.:
mypi=raspi(ipaddress,name,pw);
Once the connection is made, you just have to use mypi to address the Raspberry board.
On the other hand, if you want to use Simulink in Connected IO mode, you have to clear your connection with the Raspberry, and when running the model Simulink will make a connection with the Raspberry.
If I try run mypi=raspi once Simulink is running it says that a connection already exits, so there is no variable in the workspace addressing the Raspberry.
My question: While running Simulink in Connected IO mode how can I address that connection (mypi), for example, to use readDigitalPin(mypi,pinNumber) on an App Designer application? Is it even possible?
Thanks in advance.
0 Commenti
Risposte (1)
Prasanth Sunkara
il 16 Dic 2021
Hi Jon,
You can only have one connection to the Pi, either from MATLAB Connected I/O(through r = raspi()) or Simulink Connected I/O. But not both at the same time. If you attempt to make connection to the same Pi from MATLAB while Simulink IO is running, you would see the error you mentioned above. Vice-versa would also cause an error.
Under the hood both MATLAB and Simulink Connected I/O, communicate with Pi using same technology. The communication channel allows only one connection at a time to avoid any conflicting commands send to Pi from two different places. Hence it is not possbile to do both.
If you want to control your Pi through MATLAB simultaneously, please use a Simulink workflow that does not use the same communication channel as that of Connected I/O. You can use either Simulink Monitor & Tune workflow(aka external mode) or a complete model deployment.
-Prasanth
Vedere anche
Categorie
Scopri di più su Raspberry Pi Hardware in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!