Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (33 sloc) 1.2 KB

Example module Microsoft.PowerShell.IoT.LED

This simple PowerShell module is for turning on/off a single color LED.

An LED is on

This showcases GPIO functionality of the Microsoft.PowerShell.IoT module.

Hardware setup

Hardware pieces:

Wiring diagram


Software setup

Install PowerShell Core on Raspberry Pi

Installation instructions can be found here.

Start Powershell and install modules

sudo pwsh

Install-Module -Name Microsoft.PowerShell.IoT

git clone

Import-Module ./PowerShell-IoT/Examples/Microsoft.PowerShell.IoT.LED


# Turn LED on
Set-Led -Pin 1 -State On
# or
Set-Led 1 On
# or
[PSCustomObject]@{Pin=1; State="On"} | Set-Led

# Turn LED off
Set-Led 1 Off
You can’t perform that action at this time.