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

11 ビュー (過去 30 日間)
Martin Todd
Martin Todd 2024 年 8 月 15 日
編集済み: akshatsood 2024 年 8 月 20 日
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

回答 (1 件)

akshatsood
akshatsood 2024 年 8 月 20 日
編集済み: akshatsood 2024 年 8 月 20 日
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.

カテゴリ

Help Center および File ExchangeSerial and USB Communication についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by