簡體   English   中英

我如何使用 c# 在 windows iot 中使用 USB 電纜作為串行端口將 arduino uno 連接到 rasberry pi 3

[英]how can i connect arduino uno to rasberry pi 3 using usb cable as serial port in windows iot using c#

using System;
using System.IO.Ports;
namespace sampleserialport
{
    public sealed partial class MainPage : Page
    {

        public MainPage()
        {
            this.InitializeComponent();
            string[] ports = SerialPort.GetPortNames(); 
            Console.WriteLine("The following serial ports were found:");  
            // Display each port name to the console.      
            foreach(string port in ports) 
            {        
                Console.WriteLine(port);     
            }         
            Console.ReadLine();   
        }  
    }
}

這是正在使用的代碼,但在行中出現錯誤

string[] ports = SerialPort.GetPortNames(); 

作為

System.PlatformNotSupportedException: '當前平台不支持枚舉串行端口名稱。'

System.IO.Ports 命名空間中的 API 無法在 Windows IoT Core 上運行。 CP2102 USB 2.0 to TTL Module Serial Converter 列在硬件兼容性列表中,您可以參考這里的示例代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM