Location: PHPKode > scripts > PHP Serial > php-serial/example.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)

// Then we need to open it

// 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

// We can change the baud rate

// etc...
Return current item: PHP Serial