Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 28 of 28

Thread: Implementing TeensyLoader into a C# app?

  1. #26
    Junior Member
    Join Date
    Sep 2021
    Posts
    6
    Hi,

    thank you for your help. I have a quastion about your new repo.

    Is there a quick way to read the COM port name?

    Code:
    foreach (var teensy in watcher.ConnectedTeensies)
    {
          portCOM_comboBox.Items.Add(teensy);
    }
    But this reads all data about connected teensy. I only need COM port number

  2. #27
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,623
    E.g.
    Code:
    foreach (var board in watcher.ConnectedTeensies.Where(t => t.Ports.Any())) //loop through all connected boards which expose at least one COM port
    {                                                                            
       foreach (var port in board.Ports) // loop through all COM ports of the current board                    
       {
           Console.WriteLine(port);
       }
    }
    The example takes care of the fact that not all Teensies expose a COM port and that a Teensy can expose up to 3 COM ports.

  3. #28
    Junior Member
    Join Date
    Sep 2021
    Posts
    6
    Thank you. Everything is working great!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •