Hello,
After a lot of hours I could resolve the issue, it was because the code, you have to change the:
while (!Serial) {}
with
while (!Serial) {
waiting++;
if (waiting> 9) {
debug = false;
break;
}
Before the Arduino was search of the Serial connection, and with the battery there is not that connection. With the new code it works good.