赞
踩
1.本机可以使用 串口虚拟串口程序
test.js
//遍历获取串口名称
var added = true;
var onGetDevices = function(ports) {
var newArr = [];
for (var i = 0; i < ports.length; i++) {
newArr.push(ports[i].path);
var select = document.getElementById("selectch");
if (i==0) {
}else{
select.options.add(new Option(newArr[i],newArr[i]));
}
}
var chuankou = document.getElementById("selectch").value
//chrome.serial.disconnect(connectionId,disConnet);
chrome.serial.connect(chuankou, {
bitrate: 9600
}, onConnect);
}
//获取串口设备名,并将串口设备信息当参数传入指定的onGetDevices函数
chrome.serial.getDevices(onGetDevices);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。