android to arduino communication


hello all,

i'm trying set communication between android phone , arduino on bluetooth. using modified version of googles bluetooth chat sample able connect arduino mega outfitted rn42 bluetooth chip.

using following code able send messages phone phone unable send arduino.
code: [select]
#include <softwareserial.h>

int bluetoothtx = 2;
int bluetoothrx = 3;

softwareserial bluetooth(bluetoothtx, bluetoothrx);

void setup()
{
  //setup usb serial connection computer
  serial.begin(9600);

  //setup bluetooth serial connection android
  bluetooth.begin(115200);
  bluetooth.print("$$$");
  delay(100);
  bluetooth.println("u,9600,n");
  bluetooth.begin(9600);
}

void loop()
{
  //read bluetooth , write usb serial
  if(bluetooth.available())
  {
    char tosend = (char)bluetooth.read();
    serial.print(tosend);
  }

  //read usb serial bluetooth
  if(serial.available())
  {
    char tosend = (char)serial.read();
    bluetooth.print(tosend);
  }
}


as far can tell (not great arduino) looking char print not string?
can convert char string?

thanks

quote
as far can tell (not great arduino) looking char print not string?

it? "it" looking char print?

quote
using following code able send messages phone

so, means bluetooth device connected, , configured, , paired phone.

quote
but phone unable send arduino.

sounds problem app on phone, rather arduino problem.


Arduino Forum > Using Arduino > Programming Questions > android to arduino communication


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support