Notes on usage: As stated on the README.md, protected method processData(byte buffer[], int numBytesRead) needs to be overridden if you want to actually do anything with the data, otherwise it just writes the output to a file.
Example usage:
USBSerialDevice mySerialDev = new USBSerialDevice(this, 1027, 19200, 10){ @Override protected void processData(byte[] buffer, int numBytesRead) { // Print out the buffer to log or something } }; mySerialDev.setDirectory("/sdcard/mydirectory/"); mySerialDev.setFileNameUsingTimestamp("ARDUINO"); mySerialDev.setRecord(true); mySerialDev.start();
No fuss, no muss. Much easier than having to copy the 100+ lines of code for USB broadcast receiver, intent filters, usb device listing, etc
No comments :
Post a Comment