1

Topic: How Arduino can know if Bluethoot RemoteXY App is connected .

Hi I need to know (in Arduino)  if the my RemoteXY app is connected or not via Bluethoot software serial.
There is a way ?

Many thanks to all of you.

Valerio

2

Re: How Arduino can know if Bluethoot RemoteXY App is connected .

effevalerio@iol.it wrote:

Hi I need to know (in Arduino)  if the my RemoteXY app is connected or not via Bluethoot software serial.
There is a way ?

Many thanks to all of you.

Valerio

Yes, and no....

If you look at the last entry in the RemoteXY configuration block, you will see

    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0

This sort of half works correctly : the "connect_flag" is true (non-zero) when connected, and goes false (zero) if the connection is lost.

However, I have discovered that if the app connects again, for example, after switching to another app on your phone, your serial communications restarts, but the "connect_flag" stays false.  In these scenarios, you have to "Stop" the app, and restart it, to get the connect_flag true again.

I haven't delved into the RemoteXY handling code to find the reason, but that must be where the problem exists, because it can't be the mobile app writing that flag's value...

2B, or not 2B, that is the pencil ...

3

Re: How Arduino can know if Bluethoot RemoteXY App is connected .

Hi DABA many thanks for your reply,

...before to write my post I tryed to add to my sketch follow "monitor line":

SerialPrint(RemoteXY.connect_flag);

then connect and disconnect the BT app, but nothing happen...

may I suggest to add in "Controls" someting like a "Self Alternate Output Variable"
that switch between ON and OFF every 1 second like a BLINK
in this way, if the connection will be lost, the related RemoteXY Output variable
will stop to BLINK, in this way the running skecth, with few appropriate
lines of code, can understand when connection is lost.

Many thanks for your attention.

Valerio

4

Re: How Arduino can know if Bluethoot RemoteXY App is connected .

effevalerio@iol.it wrote:

Hi DABA many thanks for your reply,

...before to write my post I tryed to add to my sketch follow "monitor line":

SerialPrint(RemoteXY.connect_flag);

then connect and disconnect the BT app, but nothing happen...

may I suggest to add in "Controls" someting like a "Self Alternate Output Variable"
that switch between ON and OFF every 1 second like a BLINK
in this way, if the connection will be lost, the related RemoteXY Output variable
will stop to BLINK, in this way the running skecth, with few appropriate
lines of code, can understand when connection is lost.

Many thanks for your attention.

Valerio

You can suggest as much as you want, but unless the developer of RemoteXY returns to support his creation, we are stuck with what we have.  He appears to have abandoned it, and hasn't been seen on here since April.

And your command looks a bit off, try

Serial.print(RemoteXY.connect_flag);

that . is important, so is the lower-case p on print.

I assume you have also "started" your serial comms in setup()

Serial.begin(baudrate);

choose your own baudrate

2B, or not 2B, that is the pencil ...

5

Re: How Arduino can know if Bluethoot RemoteXY App is connected .

Hi DABA OK I will see if someting happen....

and OK my sintax about  Serial.print(RemoteXY.connect_flag) was wong in my post (not in my sketch....) ;-)

and I confirm ;  variable "RemoteXY.connect_flag" don't  change with  BT status....

Thanks again...

Valerio

6

Re: How Arduino can know if Bluethoot RemoteXY App is connected .

effevalerio@iol.it wrote:

and I confirm ;  variable "RemoteXY.connect_flag" don't  change with  BT status....

Valerio

One of my applications is for controlling two SKY TV boxes.  They feed what I call "Green Zone" and "Red Zone" in a sports bar.

So my channel selection panel has a large LED behind the buttons, which I colour Green when the interface is switched to "Green Zone", and Red when switched to "Red Zone".  However, if the RemoteXY.connect_flag goes OFF, I colour the LED Blue. And it all works as expected, except that the connect_flag does not come back on again, after it has gone off.

This can happen because they use the same iPad for their P.O.S. terminal, so thay switch between the apps, and RemoteXY can lose connection.

Everyone who uses the app knows to "Stop" it, and "Start" it again to restore the correct Green/Red status, which is only displayed if connect_flag is true.

One thing that strikes me is - how are you testing the flag ?

If you use...

if (RemoteXY.connect_flag = 1) { .....

...that single "=" is the assignment operator, so it will turn the connect_flag on, and the "if" statement will always evaluate as true.

The correct syntax is ...

if (RemoteXY.connect_flag == 1) { .....

I always read the == as "is equal to", and it helps to ensure I use the correct syntax

2B, or not 2B, that is the pencil ...