Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Nov 15, 2017 at 03:15 PM by Bunny83 for the following reason:

The question is answered, right answer was accepted

avatar image
2
Question by kd5crs · Feb 03, 2013 at 03:50 AM · serialportserial

Why does my COM port not exist?

So this code gets all the serial ports, and makes them into a selectiongrid with one button for each port.

When you click one of the COM ports, it goes to the line after the snip:

     string[] ports;
     ports = SerialPort.GetPortNames();
     selectionGridInt = GUI.SelectionGrid (new Rect (25, 25, 300, 60), selectionGridInt, ports, 1);
 (snip)
     SerialPort SerialStream = new SerialPort(ports[selectionGridInt], 9600, Parity.None, 8, StopBits.One);

But I get an error: Port "COM11" does not exist. (COM11 is the name of the button I click, and is the only serial port on my system.) I don't understand: I'm getting the name of the port from the system, so why is it saying it doesn't exist?

(I don't know where that "5." comes from on the last line, I didn't write it there)

Comment
Comments Locked
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

  • Sort: 
avatar image
5
Best Answer

Answer by ronenz · Apr 21, 2016 at 07:16 PM

This is one of those weird things... Use this syntax for ports >10.

 new SerialPort("\\\\.\\COM11",9600);

Why? https://support.microsoft.com/en-us/kb/115831

Comment
Comments Locked · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image troien · Apr 21, 2016 at 08:02 PM 1
Share

How to necro a 3 year old post :p

Either way, I had this problem very recently aswell :p Took me a while to get an answer to this aswell :p

I used the following to conect to any port now, similar to your answer but looks slightly better in my opinion :p

 new SerialPort(@"\\.\" + portname, 9600);
avatar image Seraphic572 · Nov 15, 2017 at 10:13 AM 0
Share

This is not Working For me

avatar image Bunny83 · Nov 15, 2017 at 03:15 PM 0
Share

Since this is actually an off-topic question and it has already been answered i will close the question and lock the comments since it seems to get bumped all the time.


The SerialPort class comes with the .NET / $$anonymous$$ono framework and has no relation to Unity.

avatar image
0

Answer by MLH1407 · Feb 24, 2013 at 05:59 PM

i read somewhere that with serial ports you kan go up to COM9 caused by some 2-digit problem .. can anyone confirm this ? if that is the problem you could just filter out the 2 digit ports .. im wrestling with the serial port my self - but i haven't that many so i cant reproduce the problem here :)

Comment
Comments Locked · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sending Data From Unity To Arduino 0 Answers

send string to serial port on android 0 Answers

Unity crashes with serial ports 0 Answers

Transform Unity Object with Arduino 2 Answers

Serial Callbacks/Error Reporting. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges