-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6901d39
Showing
2 changed files
with
611 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
include "php_serial.class.php"; | ||
|
||
// Let's start the class | ||
$serial = new phpSerial; | ||
|
||
// First we must specify the device. This works on both linux and windows (if | ||
// your linux serial device is /dev/ttyS0 for COM1, etc) | ||
$serial->deviceSet("COM1"); | ||
|
||
// Then we need to open it | ||
$serial->deviceOpen(); | ||
|
||
// To write into | ||
$serial->sendMessage("Hello !"); | ||
|
||
// Or to read from | ||
$read = $serial->readPort(); | ||
|
||
// If you want to change the configuration, the device must be closed | ||
$serial->deviceClose(); | ||
|
||
// We can change the baud rate | ||
$serial->confBaudRate(2400); | ||
|
||
// etc... | ||
?> |
Oops, something went wrong.