Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #set the COM port number here
- $portno = 4
- $command_string="Test`n"
- $result1 = "NoRun"
- $result2 = "NoRun"
- $invalid = "Invalid system password"
- $count = 1
- Write-Host $command_string
- $port= new-Object System.IO.Ports.SerialPort COM$portno,9600,None,8,one
- do {
- $port.open()
- $port.WriteLine("$command_string")
- $result1 = $port.ReadLine()
- $result2 = $port.ReadLine()
- $port.Close()
- Write-Host $count
- Write-Host $result1
- Write-Host $result2
- $count++
- Start-Sleep -Milliseconds 10
- }
- while ($result2 -eq $invalid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement