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

on app, I wrote with Serial.write("rrr".getBytes()), but arduino doesn't received. #263

Open
kotran88 opened this issue Jul 16, 2019 · 3 comments

Comments

@kotran88
Copy link

kotran88 commented Jul 16, 2019

android code is as below
I checked Serialport is opened, then I write string data to arduino

     ` serialPort = UsbSerialDevice.createUsbSerialDevice(UsbSerialDevice.CP210x, device, connection,0);
                if (serialPort != null) {
                    Toast.makeText(getApplicationContext(),"opened!!!",Toast.LENGTH_SHORT).show();
                    Log.e("dialog","serialport : "+serialPort.toString());

                    serialPort.setBaudRate(9600);
                    serialPort.setDataBits(UsbSerialInterface.DATA_BITS_8);
                    serialPort.setStopBits(UsbSerialInterface.STOP_BITS_1);
                    serialPort.setParity(UsbSerialInterface.PARITY_NONE);
                    serialPort.setFlowControl(UsbSerialInterface.FLOW_CONTROL_OFF);

                    serialPort.write("rrr".getBytes());

                    serialPort.read(mCallback); //


                } else {
                    Log.e("dialog", "PORT IS NULL");
                }`

on arduino,
loop(){
}

I added blink to recognize arduino is received string data well.
but not blinking at all...
what did I do wrong.

@kotran88
Copy link
Author

my git address to refer is...

https://github.com/kotran88/SerialPrinting

@feder240516
Copy link

could you solve this? having same problem here

@helaquiz
Copy link

helaquiz commented Jun 4, 2020

You need to write in other function see the example https://github.com/felHR85/UsbSerial/tree/master/example

And in Arduino you need to begin the serial port

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