Login   Register  
PHP Classes
elePHPant
Icontem

php serial linux read problem

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP Serial  >  All threads  >  php serial linux read problem  >  (Un) Subscribe thread alerts  
Subject:php serial linux read problem
Summary:php serial read problem
Messages:1
Author:patelv98
Date:2012-11-03 15:40:37
 

  1. php serial linux read problem   Reply  
Picture of patelv98
patelv98
2012-11-03 15:40:37
hello i have tried the below code

but i am getting nothing neither error nor output please help me get out of this...
<?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("/dev/ttyS0");

// Then we need to open it
// If you want to change the configuration, the device must be closed
//$serial->deviceClose();




// We can change the baud rate
$serial->confBaudRate(9600);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->confFlowControl("none");

$serial->deviceOpen("r+b");

// To write into
//$serial->sendMessage("Hello !");

// Or to read from
$read = $serial->readPort();

for ($i=0;$i<=10;$i++){
//echo "hello";
echo $read;
}
// etc...

?>