You are here: Re: How do I read from a serial port? « PHP Programming Language « IT news, forums, messages
Re: How do I read from a serial port?

Posted by adlerweb on 07/09/07 15:37

Hi

If your scale uses the same settings as your OS (speed, etc) it should
be enough to fopen /dev/ttyS0 and use it like a file. Note: You can not
read and write with one socket - in this case you have to use two.

Example:

$string = "foobar\n";
$pointer = fopen("/dev/ttyS0","w");
fwrite ($pointer, $string);
fclose($pointer);

Florian

pnberry@gmail.com schrieb:
> Newbie here,
>
> I've got a digital scale attached to the first serial port of my Linux
> OS computer: /dev/ttyS0
> How would I set up the serial port for reading data and then how would
> I turn that data into a variable that I could use in a PHP program?
>
> Thanks for any help,
> Paul
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация