1

I'm sending strings over Bluetooth to an Android device.

I have an Arduino board with a Synapse SNAP RF100 module and a RN42 Bluetooth module connected to serial ports.

The data is read from the RF100 module and written to the RN42 on Arduino using

Serial3.write(Serial2.read());

The code running on the SNAP is written in SNAPpy (a subset of Python) and is as follows:

photval = readADC(2)
myString = "Photocell Value: " + str(photoval)
print myString

The printed string is written to the RN42 which the Android device recieves and displays in a TextView.

The above code makes the Android device display Photocell:

As you can see photoval is missing.

The string is as expected on the Python side - so either the Bluetooth is altering it or the Android is.

Does anyone know what causes this?

1 Answer 1

2

The problem was the Arduino code - I fixed it by reading incoming data with an iteration:

void loop() {
    char rxdata[14];
    if (Serial2.available() > 0){
          Serial2.readBytes(rxdata, 14);
          Serial3.write(rxdata);
   }
}

I can now see the full string I expected.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.