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

Commit 582cb80

Browse files
author
Andrew
authored
Merge pull request #7 from anmenaga/CmdletReviewPart1
Cmdlet review feedback for Plant example
2 parents 64a01af + 4a3984d commit 582cb80

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
function SoilIsDry
1+
function Read-SoilIsDry
22
{
33
Get-GpioPin -Pin 5
44
}
55

6-
function Set-Lights
6+
function Set-Light
77
{
88
param
99
(
10-
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
11-
[bool] $Value
10+
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
11+
[ValidateSet('On','Off',ignorecase=$true)]
12+
[string] $State
1213
)
13-
14-
Set-GpioPin -Pin 2 -Value $Value
14+
[bool]$value = $State -eq 'On'
15+
Set-GpioPin -Pin 2 -Value $value
1516
}
1617

17-
function Set-Water
18+
function Start-Water
1819
{
19-
param
20-
(
21-
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
22-
[bool] $Value
23-
)
24-
25-
Set-GpioPin -Pin 0 -Value (-not $Value)
20+
Set-GpioPin -Pin 0 -Value $false
2621
}
22+
23+
function Stop-Water
24+
{
25+
Set-GpioPin -Pin 0 -Value $true
26+
}

0 commit comments

Comments
 (0)