Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- How do I read from a serial port?
July 9, 2007, 3:08 pm
rate this thread
Re: How do I read from a serial port?
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.
$string = "foobar\n";
$pointer = fopen("/dev/ttyS0","w");
fwrite ($pointer, $string);