Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #set the COM port number here
- $portno = 4
- $test_word="Test"
- $result1 = "NoRun"
- $result2 = "NoRun"
- $invalid = "Invalid"
- $count = 1
- #Write-Host $command_string
- $port= new-Object System.IO.Ports.SerialPort COM$portno,9600,None,8,one
- ForEach ($word in Get-Content "C:\Users\jperkins\Downloads\4-numeric.txt")
- {
- $command_string="$word`n"
- $port.open()
- $port.WriteLine("$command_string")
- $result1 = $port.ReadLine()
- $result2 = $port.ReadLine()
- $port.Close()
- Write-Host -NoNewLine $count`t
- Write-Host -NoNewLine $word`t
- #Write-Host $result1
- Write-Host $result2
- If ($result2 -NotMatch "invalid system")
- {
- Write-Host $word
- Write-Host $result2
- $word>>"C:\Users\jperkins\Dropbox\pw_result.txt"
- Break
- }
- $count++
- Start-Sleep -Milliseconds 25
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement