Serial communication, (read, write from/to arduino ) on MATLAB Support Package for Arduino® Hardware
Mostrar comentarios más antiguos
Hello there,
I'm trying for over a week now to find the proper way to read and write from/to arduino via Matlab. I am using the MATLAB Support Package for Arduino® Hardware, (the new one not legacy). If I am not mistaken in the legacy package the code for reading what was printed in the arduino IDE serial monitor was something like
s = serial (COM3)
fopen (s)
out = fscanf(s)
Is there a way to do the same thing with the new package and how?
Respuesta aceptada
Más respuestas (4)
Esther
el 18 de Nov. de 2015
Hi, by new package do you mean Version 15.2.0 of the Arduino MATLAB Support Package, which ships Arduino 1.6.1?
- I connected an Arduino Mega and tried on R2015b with that version installed.
- Downloaded a Simulink model that tells the Arduino to send data from Analog Input Pin 0 to the serial port.
- Then I read from the serial port:
s = serial
fopen(s)
fread(s)
ans =
160
72
75
48
254
1 comentario
Pasc Peli
el 18 de Nov. de 2015
Madhu Govindarajan
el 18 de Nov. de 2015
0 votos
As far as I know there is no way to do both at the same time, as methods(a) on the arduino object does not give me anything that is along the lines of serial monitor. However, what is your use case for the serial monitor when you can monitor most of the Arduino pins using the necessary commands.
1 comentario
Pasc Peli
el 20 de Nov. de 2015
Pasc Peli
el 20 de Nov. de 2015
0 votos
Nouha Rouis
el 28 de Ag. de 2017
0 votos
Hi guys, i want to send value from matlab to arduino, but it doesn't work ? Do you have any idea? thanks
1 comentario
Categorías
Más información sobre Arduino Hardware en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!