Accelerometer (I2C) and Fona Shield (software serial) won't work together I am using a Fona 808 shield with an Arduino Uno and the LSM303 accelerometer. The accelerometer is connected via I2C and the Fona uses software serial. 

My project requires the accelerometer to be continuously polled and occasionally talk with the fona. I wrote a program that just used the fona, but once I added the accelerometer code the program would hang a few seconds after comms had been opened with the Fona. I have tested both the accelerometer and the fona shield separately, and they work fine. So, I wrote another smaller (test) program (which is attached below) to find the origin of the program, which I identified to be:

fonaSerial-&gt;begin(4800);

fona.begin(*fonaSerial);


After these lines of code are added, the problem arises. As I said before, this is what I see a few seconds after comms have been opened with the Fona.
http://pasteboard.co/A16708fo3.png

My test program reads the value from the accelerometer, calculates the magnitude of the acceleration and if it's over 20, it prints "Over 20", while also initialising Fona serial.

My question is: Why don't the accelerometer (I2C) and the Fona (Serial) work together and how this be fixed?

This is quite urgent so a quick responses are greatly appreciated!

My Code:

#include &lt;Adafruit_FONA.h&gt;
#include &lt;Adafruit_Sensor.h&gt;
#include &lt;My2_Adafruit_LSM303_U.h&gt;
#include &lt;Wire.h&gt;


#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4


#include &lt;SoftwareSerial.h&gt;
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &amp;fonaSS;


Adafruit_FONA fona = Adafruit_FONA(FONA_RST);


volatile byte accelMagnitude;

Adafruit_LSM303_Accel_Unified accel = Adafruit_LSM303_Accel_Unified(54321);

void setup() {
  // put your setup code here, to run once:

    accel.begin();

    Serial.begin(115200);


    fonaSerial-&gt;begin(4800);
    fona.begin(*fonaSerial);

}


void ReadAccel(){

//Get a new accelerometer sensor event
  sensors_event_t event;
 // Serial.println(F("Accel---------"));
  accel.getEvent(&amp;event);

  accelMagnitude = sqrt( sq(event.acceleration.x) + sq(event.acceleration.y) + sq(event.acceleration.z));

}


void loop() {
    // put your main code here, to run repeatedly:

    ReadAccel();

    if (accelMagnitude &gt; 20){

        while (accelMagnitude &gt; 20){

            Serial.println("waiting");
            ReadAccel();
        }

        Serial.println("Over 20");

    }
}
As Gerben suggests, it would not be a good practice to just add a delay and call it a day.

1) Have a large electrolytic capacitor between Vcc and GND as near as you can to the FONA and

2) FONA has getNetworkStatus(); make a small control loop and query it until you get status 1 or 5, depending on what network are you on.
From FONA's example:

if (n == 0) Serial.println(F("Not registered"));
if (n == 1) Serial.println(F("Registered (home)"));
if (n == 2) Serial.println(F("Not registered (searching)"));
if (n == 3) Serial.println(F("Denied"));
if (n == 4) Serial.println(F("Unknown"));
if (n == 5) Serial.println(F("Registered roaming"));


And then proceed with the rest of your code. You can make additional checks for signal quality with getRSSI();