SerialSketchUploader.java 文件源码

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

项目:arduino-remote-uploader 作者:
public void openSerial(String serialPortName, int speed) throws PortInUseException, IOException, UnsupportedCommOperationException, TooManyListenersException {

    CommPortIdentifier commPortIdentifier = findPort(serialPortName);

    // initalize serial port
    serialPort = (SerialPort) commPortIdentifier.open("Arduino", 2000);
    inputStream = serialPort.getInputStream();
    serialPort.addEventListener(this);

    // activate the DATA_AVAILABLE notifier
    serialPort.notifyOnDataAvailable(true);

    serialPort.setSerialPortParams(speed, SerialPort.DATABITS_8, 
            SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
    serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号