Devam Ediyor

PHP read info from ttyS0 or ttyUSB0

Hello

I need a simple script to read the information from a serial port (ttyS0 / ttyUSB0) using PHP on Ubuntu Linux.

I have tried th following code but the code hangs and no results are returned, also tried php_serial class found on [url removed, login to view] and keep getting errors.

<?php

$myFile = "/dev/ttyUSB0";

$handle = fopen($myFile, 'rb+');

$Data = fread($handle, 15);

fclose($handle);

echo $Data;

?>

Information from the serial port could come at anytime so there needs to be some sort of continuous polling waiting to receive the data from serial port.

I also need to be able to set board rate, stop bits, parity etc

The information I'm expecting to receive from the comport should look something like 000118110001001

CAN ANYONE HELP ME?

Beceriler: PHP

Daha fazlasını görün: php ttys0, php ttyusb0, php read ttys0, php read ttyusb0, ttys0 php, php fread serial port, php fread serial, read ttys0 php, php fopen ttyusb0, linux php ttys0, ttyusb0 php, ttyusb0 fread, ttyusb0 read php, ttyusb0 ttys0, php fread com port, read ttyusb0 php, fread ttys0, fopen ttyusb0 php, ttys0 ttyusb0, php ubuntu read serial, ttyusb0 fread read polling, ubuntu php serial port read, ubuntu php read serial data, php serial read, serial fread php

İşveren Hakkında:
( 2 değerlendirme ) Christchurch, New Zealand

Proje NO: #701834

Seçilen:

perumsat

First, you need to set time-limit to unlimited, so your script wont be expired in waiting. Second, you should "clean" out the buffer every-cycle reading. This is default setting for continue reading on web-based applic Daha fazlası

0 gün içinde 80$ USD
(1 Değerlendirme)
0.0

2 freelancers are bidding on average $55 for this job

workon

please check PMB

1 gün içinde 30$ USD
(54 Değerlendirme)
5.7