Loosing power when read incoming serial signal from XBee

Have any of you seen the problem when you start getting signal from Xbee and lose the power?

this is the code I have:

 

 

void loop(){

  if(Serial.available() > 0) {

    assignVar();

  }

}

 

https://www.youtube.com/watch?v=WV6hP3hR5Gw

I don’t really know how to

I don’t really know how to describe but I will try my best. I connect them with single 2S LiPo thru 6V UBEC into both Arduino and the Shield. Here is the Shield I am using:

bzb8780053_01.jpg

The board itself provide 3.3 in XBee slot. Following is the UBEC I use to reduce the current to 6V. (Ignore the black chassis)

IMG_0960.jpg

I also try to connect 2 different battery but still same thing.

Something interesting thou. The code I use:

  void loop(){

if(Serial.available() > 0) {
    assignVar();
  }

If I comment out if(Serial...  just leave assignVar(); it works. Seems like it doesn't like Serial.avaliable()

This code causing the problem, but this works:

  void loop(){

char val = Serial.read();
  Serial.println(val);
  switch(val) {
  case '4'://Move

When all servos power out, it try to connect it back but as long as I keep the XBee on remote on it gets power out right that way.