Hi all,

I am new to this forum, but I think this is a good place to ask a question about bluetooth.

I am currently developing a project (hobby) where I am using bluetooth. I found the example in de sdk (bluetoothchat) and I am using this example.

Now I want to use this bluetooth class to communicate with other devices. So far so good every thing is working fine but here is the catch: I want to be able to use a for or a foreach loop to communicate with my devices. My devices can have a adress from 1 to 16 and when the device with the address exists the device responds with a <STX><ACK><ETX>.

I want to create a for loop where I send a message like this: (Pseudocode)

for (a = 1; a <= 16;a++)
sendBluetoothMessage("<STX>a 20<<ETX>");
// here wait for response from device<STX><ACK><ETX> (MAX 2 seconds or so)
//if there is no response from the device with adress 'a' the device does not exists DO NOTHING
// if the device responds with <STX><ACK><ETX> put the device adress in an array

I tried this code above in real code but the for loop is way to fast and doesn't wait for the device response.

Can anyone please help me how I get this in Android programming. For clarity I am using the Bluetooth Chat example class from de Android SDK examples

Thanks in advance

Frank van der Horst