connect()) { echo " ok\r\n"; } else { echo " nok\r\n"; die(); } echo " \r\nReading Ports \r\n"; for ( $i=0; $i<12; $i++) { $result = $p->queryio($i, false); switch ($result) { case 0: echo "Port $i ist 0\r\n"; ; break; case 1: echo "Port $i ist 1\r\n"; ; break; case false: echo "Port $i lese-error\r\n"; ; break; default: echo "Port $i ist unbekanntes result: $result\r\n"; ; break; } } echo " \r\n Setting Ports to high \r\n"; for ( $i=0; $i<8; $i++) { if ( false == $p->setport($i,1)) { echo "ERROR on setting port $i\r\n"; } else { echo " OK setting port $i\r\n"; } } echo "(check)"; $err=false; for ($i=0; $i<8; $i++) { $result = $p->queryio($i, false); if ($result != 1) { echo "\r\nFAIL: Port $i not 1"; $err=true; } } if ($err == true) { echo "NOK"; } else { echo " OK"; } echo " \r\n Setting Ports to low \r\n"; for ( $i=0; $i<8; $i++) { if ( false == $p->setport($i,0)) { echo "ERROR on setting port $i\r\n"; } else { echo "OK setting port $i\r\n"; } } echo " (check)"; $err=false; for ($i=0; $i<8; $i++) { $result = $p->queryio($i, false); if ($result != 0) { echo "\r\nFAIL: Port $i not 0"; $err = true; } } if ($err == true) { echo "NOK"; } else { echo "OK"; } echo "\r\n Reading analog values \r\n"; for ( $i=0; $i<4; $i++) { $result = $p->queryad($i,0); if ( false == $result) { echo "ERROR reading port $i\r\n"; } else { echo "OK reading port $i (value $result)\r\n"; } } echo "\r\n Display functions"; echo "not implemented."; echo "\r\n Disconnecting"; $p->disconnect(); echo "\r\n fertig."; ?>