How to address Rasperry Pi conection when usin Simulink in Connected IO mode?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Prasanth Sunkara
el 16 de Dic. de 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
Ver también
Categorías
Más información sobre Raspberry Pi Hardware 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!