Initial sanitized SmartSpeaker snapshot
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
$port = New-Object System.IO.Ports.SerialPort COM5, 115200, None, 8, 1
|
||||
$port.ReadTimeout = 1000
|
||||
try {
|
||||
$port.Open()
|
||||
Write-Host "Reading serial port COM5..." -ForegroundColor Cyan
|
||||
$startTime = Get-Date
|
||||
while (((Get-Date) - $startTime).TotalSeconds -lt 15) {
|
||||
try {
|
||||
$line = $port.ReadLine()
|
||||
Write-Output $line
|
||||
} catch [TimeoutException] {
|
||||
# normal timeout
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Error $_
|
||||
} finally {
|
||||
if ($port -ne $null -and $port.IsOpen) {
|
||||
$port.Close()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user