0
my situation is as follows:
I have several scales connected to the server, each scale connects through a serial port, currently I am using the COM5 port (I have tried with other larger and smaller ones). These scales send a constant string through the serial port (containing the current weight shown on the serial port display). I tested with java code is worked good, except with PHP.
follows some codes already used by me:
$port = fopen('COM5', 'w'); //tente com r e r+ e nada
sleep(2);
echo fgets($port);
fclose($port);
using the above code it locks the COM5 port and only returns after restarting the apache service (PHP).
with com_dotnet.dll extension enabled in php too, I had the following error.
$serial = new DOTNET('System', 'System.IO.Ports.SerialPort');
$serial->PortName = 'COM5';
$serial->Open();
Fatal error: Uncaught com_exception: Failed to instantiate . Net Object [Createinstance] [0x80070002] The system cannot find the file specified. in C: xampp htdocs index.php:2 Stack trace: #0 C: xampp htdocs index.php(2): dotnet->dotnet('System', 'System.IO.Ports...') #1 {main} in C: xampp htdocs index.php on line 2
I know that sending information through the serial port to an Arduino sends good, I tested too, the problem occurs in reading it. any information is welcome :(
The class Phpserial, see http://answall.com/a/70993/3635 and http://answall.com/a/69562/3635
– Guilherme Nascimento