Pura vida Battery extension issue

HI,
I'm bulding and app the with an old smartphone plus and arduino nano and a HC05 BT can monitor the presence or not of electric power and in case is missing for more that x minutes allert me by SMS.
I'm using the tifunBattery1 extection vers 3. The application is simple , every n minutes I send via bt a "1" to the arduino that close a relay connecting directly the charging cable attached to the smartphone to an usb charger. As soon as the relaty is activated i read the "plugged status and "battery_level" and I expect to see the plugghed status = "USB" . I don't know why but as soon as the relay is activated the plugghed status is = unknown and as soon the relay is deactivated appear for a moment as USB connected and the return unknow because I send a command "0" via bt to deactivate the relay.
I've used the Battery3.aia as standalone and also with an arduino schetch that turn on and off the relay every 5 second and it works fine. So at the moment I've the doubt that could be such kind of incompatibility between this extention and for instance the blutooth client but I don't know how to proof.

Any suggestion is wellcome.

Your retardo procedure is blocking the device

See here how to wait correctly

Taifun

Hi, solved with your suggestion .Here how I've modified the code block to manage the "delay" with the timer:

Now I've a second question , why this block of code the first time that the app start decrease the seconds label by 1 , while the second time is enabled the clock2, the seconds label are decreased by 2 ?
immagine

Any idea why starting the second run clock2 is decreased by 2 instead than one as required?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.