-1

I'm coding C/C++ on an Arduino to communicate with a Node.js server over the serial port using the serialport Node.js package. I have written this code on a Mac. In my Node.js code I need to reference the USB port, for reference mine is:

/dev/tty.wchusbserialfa14

On a Mac, to get a list of ports in a format that will work in my Node.js code I use the terminal and this command:

ls /dev/{tty,cu}.*

I can not find the equivalent for a Windows computer. Could someone please tell me what the command is to list the ports on a Windows machine, in a format that I can use in my Node.js.

Thanks!

Edit: Added more context about use of ports

Adam
  • 125
  • 1
  • 12
  • 1
    This is not the place to ask about how to use Windows. – TomServo Sep 18 '20 at 21:26
  • Please refer to these articles. [List of all COM ports shown in device manager by using PowerShell](https://stackoverflow.com/q/40370167/9014308), [List of SerialPorts queried using WMI differs from devicemanager?](https://stackoverflow.com/q/19840811/9014308), [WMI: Get list of all serial (COM) ports including virtual ports](https://stackoverflow.com/q/45165299/9014308) – kunif Sep 19 '20 at 09:45

2 Answers2

1

You are searching not USB ports, but serial ports. Because you are using USB to serial converter that build in Arduino, and looking about serial ports. How to get list of serial ports in windows you can find here or in google.

Excuse me, can't comment yet.

LynXz
  • 78
  • 8
0

Thanks for your help! The following command gave me a list of ports in a format that will work in my Node.js code:

chgport

Adam
  • 125
  • 1
  • 12