How to send multiple strings to Android over bluetooth

Hello everyone,

I need a little guidance with an Arduino project.

Here the setup:

I have an int variable called "controller_state" ranging from 0 - 8.
During each state, the Arduino will be sending a different String to an Android device using a bluetooth connection.

These 9 states can only run one at a time, so I get no conflicts of mixed up Strings being recevied on Android.

Apart from "controller_state" I need to introduce two boolean variables "sparging_started" and "sparging_finished". These two variables will trigger the sending of different strings "at the same time" as the string from "controller_state".

The outcome should be that Android receives one string from "controller_state" and one string from one of the two booleans. The actual outcome is that these two strings are being mixed together.

How could I prevent this and still be able to send two different strings (nearly at the same time) once every second?

Thanks in advance!

EDIT:

Codes are attached...

Output on Android will look like this:

Let's say Arduino is in "controller_state == 4"
Android will receive a string like this:

#21.94,20.45,0.5,10!

Android will receive this string every second, over and over

Arduino.pde (30.4 KB)

Android_receive.c (14.6 KB)

Android_send.c (2.78 KB)

Bavilo:
I assume that the Arduino is just way to fast for the Bluetooth connection and just takes both Strings and tries to push them through the Serial connection as fast as it can.

Probably not. It is more likely to be entirely down to your bad code, but nobody will ever know because it is a secret.

Please follow the forum rules and post all the code.

As well as posting your complete program you need to tell us what the Android is expecting. In general a data transmission system needs to match the sending system with the receiving system and it is usually easier to make the sender match the receiver than vice versa.

Also, have you written the Android program and have you the opportunity to change it?

...R

Yes I have written the Android App and I will post the receiving Part.

I will change the first post to make this cleaner.

Few people want to download unknown files from pastebin. Please post the code using code tags.

Well like I said the entire code doesn't fit here....how else could I post it?

You can add it as an attachment.

However I have no intention of trying to figure out Android code. What you need to do is tell is the format in which it expects to receive data from the Arduino.

As you are able to modify the Android code you may be interested in the system in the 3rd example in Serial Input Basics - it should be straightforward to write an Android equivalent.

...R