SerialSketchUploader.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:arduino-remote-uploader 作者:
public CommPortIdentifier findPort(String port) {
    // parse ports and if the default port is found, initialized the reader
    Enumeration portList = CommPortIdentifier.getPortIdentifiers();

    while (portList.hasMoreElements()) {

        CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement();

        if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {

            //System.out.println("Found port: " + portId.getName());

            if (portId.getName().equals(port)) {
                //System.out.println("Using Port: " + portId.getName());
                return portId;
            }
        }
    }

    throw new RuntimeException("Port not found " + port);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号