1. 使用svn从 http://android-serialport-api.googlecode.com/svn/trunk/android-serialport-api check_out工程。
if (mSerialPort == null) { /* Read serial port parameters */ String path = "/dev/ttyS0"; int baudrate = 115200; /* Check parameters */ if ( (path.length() == 0) || (baudrate == -1)) { throw new InvalidParameterException(); } /* Open the serial port */ mSerialPort = new SerialPort(new File(path), baudrate, 0); } return mSerialPort; } public void closeSerialPort() { if (mSerialPort != null) { mSerialPort.close(); mSerialPort = null; } } OutputStream mOutputStream = app.getSerialPort().getOutputStream(); |
Android 读写串口
猜你喜欢
转载自blog.csdn.net/shenxingshu/article/details/89337581
今日推荐
周排行