This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Listens to and read data from a serial port (e.g. COM port) | |
.DESCRIPTION | |
The purpose of this script is to keep listening and read data from a serial port. | |
All the data captured will be displayed and log into a file. | |
.EXAMPLE | |
./SerialPortReader.ps1 | |
.EXAMPLE | |
./SerialPortReader.ps1 -PortName COM3 -BaudRate 9600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
This function can be used to pass a ScriptBlock (closure) to be executed and returned. | |
The operation retried a few times on failure, and if the maximum threshold is surpassed, the operation fails completely. | |
Params: | |
Command - The ScriptBlock to be executed | |
RetryDelay - Number (in seconds) to wait between retries | |
(default: 5) | |
MaxRetries - Number of times to retry before accepting failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Install Chocolatey | |
<# | |
Set-ExecutionPolicy RemoteSigned -Force | |
# Create empty profile (so profile-integration scripts have something to append to) | |
if (-not (Test-Path $PROFILE)) { | |
$directory = [IO.Path]::GetDirectoryName($PROFILE) | |
if (-not (Test-Path $directory)) { | |
New-Item -ItemType Directory $directory | Out-Null | |
} |
NewerOlder