Jump to content

Hi !

Does anyone know why this doesn't work?

$port= new-Object System.IO.Ports.SerialPort COM4,9600,None,8,one
$port.Open()
while($true) {
 
$line = $port.ReadLine()

echo $line


If ($line -eq "1"){
    echo "Hello"
}


}


If it recieves a 1 it doesn't print Hello.

Link to comment
https://linustechtips.com/topic/1326672-why-wont-my-powershell-script-work/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×