@@ -11,6 +11,34 @@ created a convenience class to access the serial port though the Linux file.
1111Afterwards, I posted it to [ PHP Classes] ( http://www.phpclasses.org/package/3679-PHP-Communicate-with-a-serial-port.html ) ,
1212and this probably is what brought it any visibility.
1313
14+ Example
15+ -------
16+
17+ ``` php
18+ <?php
19+ include 'PhpSerial.php';
20+
21+ // Let's start the class
22+ $serial = new PhpSerial;
23+
24+ // First we must specify the device. This works on both linux and windows (if
25+ // your linux serial device is /dev/ttyS0 for COM1, etc)
26+ $serial->deviceSet("COM1");
27+
28+ // We can change the baud rate, parity, length, stop bits, flow control
29+ $serial->confBaudRate(2400);
30+ $serial->confParity("none");
31+ $serial->confCharacterLength(8);
32+ $serial->confStopBits(1);
33+ $serial->confFlowControl("none");
34+
35+ // Then we need to open it
36+ $serial->deviceOpen();
37+
38+ // To write into
39+ $serial->sendMessage("Hello !");
40+ ```
41+
1442State of the project
1543--------------------
1644
@@ -91,4 +119,4 @@ GNU General Public License for more details.
91119
92120You should have received a copy of the GNU General Public License along
93121with this program; if not, write to the Free Software Foundation, Inc.,
94- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
122+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0 commit comments