Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhysicaloidLibrary read data. #19

Open
alekssandr89 opened this issue Jan 31, 2016 · 3 comments
Open

PhysicaloidLibrary read data. #19

alekssandr89 opened this issue Jan 31, 2016 · 3 comments

Comments

@alekssandr89
Copy link

Hellow.
On Arduino UNO i read data(use FTD library) like this

StringBuilder mText = new StringBuilder();
FTDriver mSerial = new FTDriver((UsbManager)getSystemService(Context.USB_SERVICE));
PendingIntent permissionIntent = PendingIntent.getBroadcast( this, 0,
new Intent(ACTION_USB_PERMISSION), 0);
mSerial.setPermissionIntent(permissionIntent);

int i,len;
byte[] rbuf = new byte[4096];
len = mSerial.read(rbuf);
if (len>0){
for(i=0; i<len; i++) {
mText.append((char) rbuf[i]);
}

It's work great.
But when i try read data use PhysicaloidLibrary

private int mBaudrate = 9600;
private int mDataBits = UartConfig.DATA_BITS8;
private int mParity = UartConfig.PARITY_NONE;
private int mStopBits = UartConfig.STOP_BITS1;
StringBuilder mText = new StringBuilder();

Physicaloid mPhysicaloid = new Physicaloid(this);
mPhysicaloid.open();
mPhysicaloid.setConfig(new UartConfig(mBaudrate, mDataBits, mStopBits, mParity, false, false));

int i,len;
byte[] rbuf = new byte[4096];
len = mPhysicaloid.read(rbuf);
if (len>0){
for(i=0; i<len; i++) {
mText.append((char) rbuf[i]);
}

it does not work.
But write data using both library is no problem. Everything works.
Tell me please, why the data can not be read using PhysicaloidLibrary?

@alekssandr89
Copy link
Author

I fix it turns out it was necessary to update the files !

@cpbridges
Copy link

cpbridges commented Mar 28, 2017

@alekssandr89 When you say update the files? What do you mean exactly?
I'm trying to use only the jar in Android Studio to connect to an Arduino Uno too so any tips would be grand! C

@emilts
Copy link

emilts commented May 31, 2019

Hi.
I'm trying to use the library with the examples it includes, connecting to an ESP32 and always getting strange characters to read the data received in the application.

Can you give me some clue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants