I am working on a communication between androidAndroid and arduinoArduino board.
The android makeAndroid makes a TCP connection with the board and successfully sendsends some stringstrings to the board.
The problem is , there is aan int in my arduinoArduino code (ege. int distanceg. int distance) and I would like to pass that back to my androidAndroid device.
I have handlehandled the androidAndroid side already , but I do not know how to return a message from arduinoArduino.
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
//in this while the client listens for the messages sent by the server
while (mRun) {
serverMessage = in.readLine();
if (serverMessage != null && mMessageListener != null) {
//call the method messageReceived from MyActivity class
mMessageListener.messageReceived(serverMessage);
}
serverMessage = null;
}
This is the androidAndroid side code but I think that it is not a specific androidAndroid problem, there should be some way for arduinoArduino to make a response of aan integer variable (without concern what is the source device)?
What I should do in ardinoArduino for making that response? Thanks for help.