xxxajk / PhysicaloidLibrary

Android Library for communicating with physical-computing boards (e.g.Arduino, mbed)
http://www.physicaloid.com/
21 stars 10 forks source link

Broken serial baud rate #8

Closed fire1 closed 6 years ago

fire1 commented 6 years ago

I'm struggling to get serial read to work... only output I'm having is:

Stream: �����������������������

Changing baud rate with method "setBaudrate()" did not help (same baud rate for arduino and device 115200 && 9600 tested) also

new String(readBuffer, "UTF-8");

did not fix it

Is there some other way to fix it or debug it ? It seems to be some problem with baud rate...

fire1 commented 6 years ago

Changing baud rate in

PhysicaloidLibrary\src\com\physicaloid\lib\usb\driver\uart\UartConfig.java

Fixes the communication Changing from setConfig or setBaudrate didn't change it ...

hamidsani commented 6 years ago

Make sure to call the setBaudrate method AFTER port is opened. If you look closer at setBaudrate method you'll find that when port is null (or it doesn't exist) then it just returns false.

xxxajk commented 6 years ago

Correct. All failed calls return false. You should always check the return values.

fire1 commented 6 years ago

thanks!