Devam Ediyor

PHP read info from ttyS0 or ttyUSB0


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.


$myFile = "/dev/ttyUSB0";

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

$Data = fread($handle, 15);


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


Beceriler: PHP

Daha fazlasını gör: 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



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 Fazla

%selectedBids___i_period_sub_7% gün içinde 80%project_currencyDetails_sign_sub_9% %project_currencyDetails_code_sub_10%
(1 Yorum)

Bu iş için 2 freelancer ortalamada $55 teklif veriyor


please check PMB

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD
(54 Değerlendirme)