4

Is it possible to access the built-in serial and the gpio ports via powershell on Windows Iot?

S.Spieker
  • 555
  • 1
  • 6
  • 18
magriii
  • 41
  • 2

1 Answers1

2

Did you try:

[System.IO.Ports.SerialPort]::getportnames()

COM1

$port= new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
$port.open()
$port.WriteLine("Hello world")
$port.Close()

And reading from a Serial Port

$port= new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
$port.Open()
$port.ReadLine()

Edit:

I found out on this site: https://social.msdn.microsoft.com/Forums/en-US/b9633593-377e-4d6f-b3a9-838de0555371/serialdevicefromidasync-always-returns-null-unless-the-serial-adapter-is-plugged-in-after-boot

Serial port is used by debugger for kernel and is not available to use by other devices. There is a solution described there, but I cant confirm if it is working as I don't have Windows on my PI2, it's just simply too much overhead with that.

Bungee75
  • 121
  • 4