php serial communication problems


hi!
i'm facing serial communication problems.
i want update textfield data reading serial port php.
but textfields won't update.
this code:


error_reporting(e_all);

ini_set("display_errors", 1);

define("port","/dev/ttyusb0"); 



if (isset($_get['action'])) { 

      $action=$_get['action'];

      include "php_serial.class.php";

      $serial = new phpserial;

      $serial->deviceset(port);

      $serial->confbaudrate(9600);

      $serial->confparity("none");

      $serial->confcharacterlength(8);

      $serial->confstopbits(1);

      $serial->confflowcontrol("none");

      $serial->deviceopen();

      $action = $_get['action'];

      if($_get['action']{1}==0){

         $serial->sendmessage($action);

         usleep(10000);

         echo ($read);

      }else if($_get['action']{1}!=0){

         $serial->sendmessage($action);

      }

      $serial->deviceclose();

   }

for example when try write , read serial port, doesn't work.

it's long time since dabbled php wonder if program opens , closes serial port. opening serial port causes arduino reset takes few seconds when not listening making arduino forget whatever doing. program should open serial port , keep open until finished arduino.

in programs put serial.println("<arduino ready>"); in setup()  and pc program waits until receives knows arduino has restarted.

...r


Arduino Forum > Using Arduino > Interfacing w/ Software on the Computer > php serial communication problems


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor