Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Latest commit

 

History

History
52 lines (33 loc) · 1.2 KB

File metadata and controls

52 lines (33 loc) · 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

wiring

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 https://github.com/PowerShell/PowerShell-IoT.git

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

Usage

# 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