I have a very strange situation.
I own an Arduino UNO and this Bluetooth module:http://dx.com/p/jy-mcu-arduino-bluetooth-wireless-serial-port-module-104299
I have written an Android App to communicate with my Arduino, pairing etc.
But if I send as example the String "testtest" from my Android Smartphone,
the Arduino recieves "t¬. ¹º", the number of characters is right, but only the first one is
I can confirm this behaviour with different transmitted data.
This is how i initialize my Bluetooth module:
int pin = 1234;
char* name = "Arduino";
And this is how I read the data:
while(btConnection.available() > 0)
char aChar = btConnection.read();
if(aChar == '\n')
// recieved whole data, do something
The strange thing is, that it also never goes inside the
if(aChar == '\n') block.
The first char received is always right, and if I just send one char commands via bluetooth
everything works as expected. But I need to send more data.
First thought was that the bps are wrong, but all internet resources confirm that 115200 is the right one for bluetooth.
If i set it lower I only receive garbage, not even one char correct.
So is there something wrong in how I read the incomming data?
If I connect from CoolTerm on OSX to the Arduino over Bluetooth
with the following settings: baudrate 115200, data bits 8, parity none, stop bits 1
So I am currently not sure where the issue is (Arduino or Android), but since
this subforum is about Networking i thought someone already tried to connect
from an Android device.
In Java (Android) I just do:
byte send = "testtest".getBytes();
where mChatService holts the BluetoothSocket and writes the data on the OutputStream.
Basically it consists of the Android Sample App "BluetoothChat" modified a bit.
Basically I do createInsecureRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805F9B34FB")); to connect to the Arduino.
Any ideas what to try out next?