UWP serial port communication for character write and read (UWP and Arduino)
问题 I am using this code but not working and throwing this exception: Object reference not set to an instance of an object devices[0] giving me null value. private async void ConnectToSerialPort() { string selector = SerialDevice.GetDeviceSelector("COM7"); DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(selector); if (devices.Count > 0) { DeviceInformation deviceInfo = devices[0]; SerialDevice serialDevice = await SerialDevice.FromIdAsync(deviceInfo.Id); Debug.WriteLine