note 97613 deleted from function.fopen by danbrown
| From: | danbrown@php.net | Date: | Wed, 28 Apr 2010 14:52:03 +0000 |
| Subject: | note 97613 deleted from function.fopen by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168759@lists.php.net to get a copy of this message | ||
Note Submitter: Kasui
----
In his note from 22-Apr-2002 08:33, jared at dctkc dot com explained how to use the serial port
(thanks for that !).
However, the "COMx:" notation works only for COM1 to COM9.
If you need to work with ports higher than COM9, you can use the \\.\COMx notation, as shown in the
following example :
<?php
//choose and configure COM port
$comPort = "COM10";
mode $comPort: BAUD=9600 PARITY=N data=8 stop=1 xon=off;
//open serial port
$fp = fopen ("\\\\.\\$comPort", "w+") or die("Error opening the
port");
//write on the port
$string = "Hello world !\r\n";
fputs ($fp, $string);
fclose ($fp);
?>