note 97613 added to function.fopen
| From: | Kasui at osu1 dot php dot net | Date: | Wed, 28 Apr 2010 09:06:52 +0000 |
| Subject: | note 97613 added to function.fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168747@lists.php.net to get a copy of this message | ||
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);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 212.43.209.7
----
Manual Page -- http://www.php.net/manual/en/function.fopen.php
Edit -- https://master.php.net/note/edit/97613
Del: integrated -- https://master.php.net/note/delete/97613/integrated
Del: useless -- https://master.php.net/note/delete/97613/useless
Del: bad code -- https://master.php.net/note/delete/97613/bad+code
Del: spam -- https://master.php.net/note/delete/97613/spam
Del: non-english -- https://master.php.net/note/delete/97613/non-english
Del: in docs -- https://master.php.net/note/delete/97613/in+docs
Del: other reasons-- https://master.php.net/note/delete/97613
Reject -- https://master.php.net/note/reject/97613
Search -- https://master.php.net/manage/user-notes.php