Ok, now I really need some help… this forum never fails to me ?
[CODE]comando=”P”+Kp+”I”+Ki+”D”+Kd+”R”+Ref+”F”;
com_server=”serial2.php?var1=”+comando;
var request = window.ActiveXObject ? new ActiveXObject(“Microsoft.XMLHTTP”) : new XMLHttpRequest();
request.open(“GET”,com_server,true);
request.send(null);
that is my javascript to get the php page which is the following:
[code=php]`mode com3: BAUD=19200 PARITY=N data=8 stop=1 xon=off`;
$fp = fopen (“COM3:”,”a”);
if($string = $_GET[‘var1’]){
$long=strlen($string);
fwrite($fp,$string,$long);
}
fclose ($fp);
The data is sent through the serial port only some times, others it doesn’t work, and I have tested the serial port and it opens and closes without any problem…
It usually works randomly… the only pattern I was able to catch is:
if the variable comando doesn’t change, data is NEVER sent through the serial port…
and for the record, if I do the following thing instead of using httprequest it NEVER fails, but I am forced to open a popup window, which is not very nice for the user
[CODE]options=”toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=1,height=1,top=1,left=1″;
window.open(‘serial2.php?var1=’+comando,””,options);
any ideas of where the problem could be?