# Problem with battery

**URL:** <https://forum.arduino.cc/t/problem-with-battery/571126>\
**Category:** MKR FOX 1200\
**Created:** [January 31, 2019, 1:49am UTC](https://forum.arduino.cc/t/problem-with-battery/571126 "2019-01-31T01:49:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iMarques](https://avatars.discourse-cdn.com/v4/letter/i/f4b2a3/32.png) [@iMarques](https://forum.arduino.cc/u/iMarques)\
**Post date:** [January 31, 2019, 1:49am UTC](https://forum.arduino.cc/t/problem-with-battery/571126/1 "2019-01-31T01:49:59Z")

</div>

Hello,

My code works grate when the Arduino mkr 1200 is connected to the usb of the mac, but it does not work with the 2xAA batteries. With the usb and also with the batteries i could see the led of a GPS module connected to the board, but the Sigfox message never arrive to sigfox backend with the batteries. The debug mode is not enabled in the code.

can someone help me?

---

<div class="post-metadata">

**Author:** ![iMarques](https://avatars.discourse-cdn.com/v4/letter/i/f4b2a3/32.png) [@iMarques](https://forum.arduino.cc/u/iMarques)\
**Post date:** [February 10, 2019, 8:21pm UTC](https://forum.arduino.cc/t/problem-with-battery/571126/2 "2019-02-10T20:21:51Z")

</div>

Hello,

After a lot of hours I could resolve the issue, it was because the code, you have to change the:

```cpp
while (!Serial) {}

```

with

```cpp
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.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 7, 2021, 11:53am UTC](https://forum.arduino.cc/t/problem-with-battery/571126/3 "2021-05-07T11:53:08Z")

</div>

Closed on May 7, 2021, 11:53am UTC


