trying to connect to arduino but dissapears from serialport​list("avai​lable")

5 visualizaciones (últimos 30 días)
Sorry if this is me being ridiculous but it's driving me up the wall!!
Trying to replicate a device using an arduino. All set up and the device once plugged in comes up as 'available'. I then try to connect and nada! I list the available ports again and it has dissapeared!
Any help??
>> serialportlist("available")
ans =
"COM3"
>> serialportlist("available")
ans =
1×0 empty string array
>> delete(instrfind({'Port'},{'COM3'}));
Warning: instrfind will be removed in a future release. There is no simple replacement for this.
>> serialportlist("available")
ans =
1×0 empty string array

Respuestas (1)

akshatsood
akshatsood el 20 de Ag. de 2024
Editada: akshatsood el 20 de Ag. de 2024
I understand that you are encountering issues with arduino disconnecting or not being recognized properly by MATLAB after an initial connection attempt.. Here are a few suggestions to help troubleshoot and resolve the issue:
Check Physical Connections:
  • Ensure the USB cable is securely connected to both the Arduino and the device.
  • Try using a different USB cable or port if possible.
Check Device Manager (Windows) or System Information (Mac):
  • On Windows, open Device Manager and look for the "Ports (COM & LPT)" section. Check if your Arduino appears there and if any warning icons are displayed.
  • On Mac, open System Information and check under "USB" to see if the Arduino is listed.
  • If the device appears with a warning or not at all, it might be a driver issue.
Use serialport in MATLAB:
  • Since "instrfind" is deprecated, consider using the "serialport" function for managing serial connections.
% Create a serial port object
s = serialport("COM3", 9600); % Replace 9600 with your baud rate
I hope this helps.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by