Using various tutorials, I have managed to connect my Android phone to a HC-05 bluetooth module connected to an Arduino. What I'm trying to do is have 5 Buttons set up that will transmit a unique integer per button only when the button is held down, otherwise they will send a "0" when the button is released. ergo BUTTON1 sends a "1" when pressed and "0" when released, BUTTON2 sens a "2" when pressed and a "0" when released. Currently, I cannot figure out how to send ANY data over the connection. From reading and watching various tutorials I've gained a small understanding but seem to be missing something.
Towards the bottom of my code in the public void run(), i have set up an OnClickListener for one of my buttons to try to send...well something once its pressed just to see if I can send SOMETHING useful to the Arduino.
Here is where I have my OnClickListener. I believe I should be sending "T" to the Arduino.
pUpBtn.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v) {
String testr="T:";
byte[] msgBuffer = testr.getBytes();
try {
mmOutStream.write(msgBuffer);
} catch (IOException e) {
e.printStackTrace();
}
}
});