4

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

1
  • Hello and welcome. I have taken the liberty to edit your question. If you don't like it, feel free to revert. If you have anything to add (e.g. to be more specific) just edit to add.
    – Ghanima
    Commented Dec 13, 2015 at 1:01

1 Answer 1

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.

1
  • This works fine on my PC, but not with the PI. Unable to find type [System.IO.Ports.SerialPort]. At line:1 char:1 + [System.IO.Ports.SerialPort]::getportnames() + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.IO.Ports.SerialPort:TypeName) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound
    – magriii
    Commented Dec 14, 2015 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.