How to two values through Serial.read()

I am making a project where a led is being faded. The faded value and the time is given as user input by android. But when I'm sending the value of brightness/fade value, it's also becoming the value of time/delay time. How to resolve this? The values are overlapping.

use a delimiter between two value and use Serial.readBytesUntil() or Serial.readStringUntil()

What is delimiter? I have another question. When android is sending values is it in bytes or string? When I wrote the quote it was like // buetoothsocket.getoutputstream.write("TO".toString().getBytes()) // so is it string or byte or both? And in arduino what's it reading? byte or string?

A delimiter is a character decided by yourself to distinguish between command or frame

If you want to learn about serial communication read Robin2's excellent tutorial
https://forum.arduino.cc/index.php?topic=396450.0

My suggestion would be to get your project working with a bluetooth Serial terminal app like Kai Morich's before working out custom Android code.

It's more simple to send and receive text.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.