\n"; } else { $str = ""; foreach($one as $b) $str .= sprintf("%02x ", $b); echo("Sending: " . $str . "\n"); fwrite($fp, pack("C*", ...$one)); echo("Reading: "); for($i=0; $i<29; $i++) { $b = fgetc($fp); printf("%02x ", $b); } $str = ""; foreach($two as $b) $str .= sprintf("%02x ", $b); echo("Sending: " . $str . "\n"); fwrite($fp, pack("C*", ...$two)); echo("Reading: "); for($i=0; $i<11; $i++) { $b = fgetc($fp); printf("%02x ", $b); } fclose($fp); echo("\nEnd\n\n"); } ?>