Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/472.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法使用phpSerial和XAMPP打开COM端口_Javascript_Php_Html_Mysql - Fatal编程技术网

Javascript 无法使用phpSerial和XAMPP打开COM端口

Javascript 无法使用phpSerial和XAMPP打开COM端口,javascript,php,html,mysql,Javascript,Php,Html,Mysql,我正在使用COM端口(COM10)进行通信 这是我的代码:(非常类似于) 你知道为什么这样不行吗 我的设备已连接到COM10,并显示为Silicon Labs CP210x USB到UART网桥(COM10)您确定您的设备已连接到COM10吗。你能检查一下你的串行端口和你的设备是什么吗?你确定我的设备连接到了COM10。我的设备是“Silicon Labs CP210x USB到UART桥接器(COM10)”,因为你在windows下,你可能会遇到访问COM10及以上COM端口的不同方式。如果不

我正在使用COM端口(COM10)进行通信

这是我的代码:(非常类似于)

你知道为什么这样不行吗


我的设备已连接到COM10,并显示为Silicon Labs CP210x USB到UART网桥(COM10)

您确定您的设备已连接到COM10吗。你能检查一下你的串行端口和你的设备是什么吗?你确定我的设备连接到了COM10。我的设备是“Silicon Labs CP210x USB到UART桥接器(COM10)”,因为你在windows下,你可能会遇到访问COM10及以上COM端口的不同方式。如果不查看库的源代码或只是尝试一下,就无法判断。因此,您应该尝试使用\\.\COM10而不是COM10-因为您必须避开斜杠,所以您需要使用以下字符串“\\\.\\COM10”(如果确实存在此问题)。更多信息,请参见此处:编辑只是查看源代码-我的5美元赌注说这就是问题所在。该库仅使用fopen和COM端口名。您能否正确地告诉我..我没有读取串行端口..相同的警告显示到me@karthickkannan-你是说我?(在用户名前加一个@以确保他们得到通知)如果是这样,你能用另一种方式说吗,因为我不太明白你在问/告诉我什么。:)
<?php
require('php_serial.class.php');

echo "<html>
      <head><title>Test MySQL</title></head>
      <body>";

// Let's start the class
$serial = new phpSerial;

$serial->deviceSet("COM10");

$serial->confBaudRate(1200);
$serial->confParity("none");
$serial->confCharacterLength(7);
$serial->confStopBits(1);
$serial->deviceOpen();

$serial->sendMessage("Hello !");

$read = $serial->readPort();

echo "here it is";
echo $read;
echo "here it was";

sleep(1);

$serial->deviceClose();

?>
</body></html>
Warning: Specified serial port is not valid in D:\xampp\htdocs\Serialport\PHP-Serial-develop\PHP-Serial-develop\php_serial.class.php on line 141

Warning: Unable to set the baud rate : the device is either not set or opened in D:\xampp\htdocs\Serialport\PHP-Serial-develop\PHP-Serial-develop\php_serial.class.php on line 234

Warning: Unable to set parity : the device is either not set or opened in D:\xampp\htdocs\Serialport\PHP-Serial-develop\PHP-Serial-develop\php_serial.class.php on line 288

Warning: Unable to set length of a character : the device is either not set or opened in D:\xampp\htdocs\Serialport\PHP-Serial-develop\PHP-Serial-develop\php_serial.class.php on line 336

Warning: Unable to set the length of a stop bit : the device is either not set or opened in D:\xampp\htdocs\Serialport\PHP-Serial-develop\PHP-Serial-develop\php_serial.class.php on line 377

Warning: The device must be set before to be open in D:\xampp\htdocs\Serialport\PHP-Serial-develop\PHP-Serial-develop\php_serial.class.php on line 167

Warning: Device must be opened in D:\xampp\htdocs\Serialport\PHP-Serial-develop\PHP-Serial-develop\php_serial.class.php on line 608

Warning: Device must be opened to read it in D:\xampp\htdocs\Serialport\PHP-Serial-develop\PHP-Serial-develop\php_serial.class.php on line 522

here it ishere it was