Hello,
I think I´m at the right board, as my question involves Android and Arduino. Sorry if is not the right place.
I need some advice from the experts for a project.
I have an arduino connected to my wifi network, running a web server, as the example in the forum. It receive commands from android clientes, as:
http://192.168.1.101/ledON turns the port to HIGH and returns HIGH
http://192.168.1.101/ledOFF turns the port to LOW and returns LOW
http://192.168.1.101/status returns HIGH or LOW depending on port status
I read the return text in B4A by using HTTP jobs.
The problem is, I have more than one android clients connected to the same arduino.
When I turn the LED on, the button on the APP turns to RED, when off turns to GRAY.
To reflect the real status of the port/LED, I have a loop in a timer running every second and checking the status of the port, via HTTP job in B4A, changing the button´s color apropriately.
But this approach is not ok, because it generates a unuseful traffic in my network, every second, and, worst, it sometimes makes arduino freeze or be crazy. I think it´s because of the serial connection that looses data.
The question is, my B4A app, can be more than one, needs to know the status of the port when it changes, even if it was changed via web browser or another app. i.e. if my daughter turns the light on, via her app, my app will show it immediately.
One important requisite is that this wifi network is not connected to the internet, at least now, for security reasons, so, I can´t connect to any external service.
I tried to use a web server in android side, and when the port changes status, arduino call the app server informing the change. It worked, but just for one app. But I used a known app static IP. If I have more than one connected I don't know how to do.
Any idea?
Thanks
I think I´m at the right board, as my question involves Android and Arduino. Sorry if is not the right place.
I need some advice from the experts for a project.
I have an arduino connected to my wifi network, running a web server, as the example in the forum. It receive commands from android clientes, as:
http://192.168.1.101/ledON turns the port to HIGH and returns HIGH
http://192.168.1.101/ledOFF turns the port to LOW and returns LOW
http://192.168.1.101/status returns HIGH or LOW depending on port status
I read the return text in B4A by using HTTP jobs.
The problem is, I have more than one android clients connected to the same arduino.
When I turn the LED on, the button on the APP turns to RED, when off turns to GRAY.
To reflect the real status of the port/LED, I have a loop in a timer running every second and checking the status of the port, via HTTP job in B4A, changing the button´s color apropriately.
But this approach is not ok, because it generates a unuseful traffic in my network, every second, and, worst, it sometimes makes arduino freeze or be crazy. I think it´s because of the serial connection that looses data.
The question is, my B4A app, can be more than one, needs to know the status of the port when it changes, even if it was changed via web browser or another app. i.e. if my daughter turns the light on, via her app, my app will show it immediately.
One important requisite is that this wifi network is not connected to the internet, at least now, for security reasons, so, I can´t connect to any external service.
I tried to use a web server in android side, and when the port changes status, arduino call the app server informing the change. It worked, but just for one app. But I used a known app static IP. If I have more than one connected I don't know how to do.
Any idea?
Thanks