How do I bring Arduino UNO serial monitor data into MATLAB?

148 visualizaciones (últimos 30 días)
Victoria Smith
Victoria Smith el 31 de Mzo. de 2021
Respondida: Aditya Shah el 7 de Jun. de 2022
I've been trying to take arduino uno serial monitor data and bring into into MATLAB code, but any questions online I found to help don't seem to work for mine, as I usually just get "MATLAB connection to Uno at COM3 exists in your workspace. To create a new connection, clear the existing object." when I try to pull in any data.
So far, all I can do that works is;
a = arduino('COM3','UNO');
which sets up an array in the workspace detailing all the pins it can read. I need it to print values for the A2 and A4 pins simultaneously!
Anyone have any ideas?
  1 comentario
Victoria Smith
Victoria Smith el 31 de Mzo. de 2021
These are the values I have printed in arduino, and I need MATLAB to recieve the 1st and 3rd printed values
Serial.print(WindSpeed); Serial.print("\t\t");
Serial.print(getKnots(WindSpeed)); Serial.print("\t");
Serial.print(CalDirection);

Iniciar sesión para comentar.

Respuestas (1)

Aditya Shah
Aditya Shah el 7 de Jun. de 2022
Hi!
Please refer to the following documentations for more information about reading streaming data from Arduino using serial communication:
  • This document explains how to enable callbacks to read streaming ASCII terminated data from Arduino® Due using the serial port interface.
  • This document explains how to use serial communication to monitor live data from Arduino Uno in MATLAB/Simulink.

Categorías

Más información sobre MATLAB Support Package for Arduino Hardware en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by