Urgent Need: Arduino Serial Output only show “initialize MS5611 Sensor”

Hi, I need urgent help with my Arduino project. The code successfully compiled and uploaded on my Arduino UNO board but the serial monitor only shows “initialize MS5611 Sensor”. I have changed the MS5611 libraries several times but nothing seems working except one line of code.
This is my code:

#include <MS5611.h>
#include <MPU6050.h>
#include <Wire.h>
#include “I2Cdev.h”
#include <SPI.h>
#include <SD.h>
unsigned long time;
const int chipSelect = 4;
// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#include “Wire.h”
MPU6050 accelgyro;
//MPU6050 accelgyro(0x69); // ← use for AD0 high
int16_t ax, ay, az;
int16_t gx, gy, gz;
MS5611 ms5611;
double referencePressure;
#define LED_PIN 13
bool blinkState = false;
void setup()
// join I2C bus (I2Cdev library doesn’t do this automatically)
Fastwire::setup(400, true);
// Initialize MS5611 sensor
Serial.println(“Initialize MS5611 Sensor”);
Serial.println(“Could not find a valid MS5611 sensor, check wiring!”);
// Get reference pressure for relative altitude
referencePressure = ms5611.readPressure();
// Check settings
// initialize device
// Serial.println(“Initializing I2C devices…”);
// verify connection
// Serial.println(“Testing device connections…”);
// Serial.println(accelgyro.testConnection() ? “MPU6050 connection successful” : “MPU6050 connection failed”);
// Serial.print(“Initializing SD card…”);
if (!SD.begin(chipSelect)) {// see if the card is present and can be initialized:
// Serial.println(“Card failed, or not present”);
// don’t do anything more:
// Serial.println(“card initialized.”);
void checkSettings()
// Serial.print("Oversampling: ");
// Serial.println(ms5611.getOversampling());
void loop() {
// read raw accel measurements from device
accelgyro.getAcceleration(&ax, &ay, &az);
// Read raw pressure and temp values
uint32_t rawTemp = ms5611.readRawTemperature();
uint32_t rawPressure = ms5611.readRawPressure();
// Read true temperature & Pressure
double realTemperature = ms5611.readTemperature();
long realPressure = ms5611.readPressure();
// Calculate altitude
float absoluteAltitude = ms5611.getAltitude(realPressure);
float relativeAltitude = ms5611.getAltitude(realPressure, referencePressure);
//change variables to strings
String comma = String (’,’);
String absalt = String (ms5611.getAltitude(realPressure)); //absoloute altitude in meters.
String temp = String ( ms5611.readTemperature()); //real temp in degrees, may over read initially, will take time for sensor to stabilize.
String realpressure = String (ms5611.readPressure()); // pressure in pascals
String accelXraw = String (ax); // raw accel in X. Divide by 2048 to get a “G” reading.
String timer = String (millis()); //puts a millis time stamp on each string.
//make a big string containing above strings
String Baro_data = String (absalt + comma + temp + comma + realpressure + comma + accelXraw + comma + timer) ;
Serial.println (Baro_data);
File dataFile= SD.open(“datalog.txt”, FILE_WRITE);
// if the file is available, write to it:
if (dataFile) {
dataFile.println(Baro_data);//put Baro_data on the SD card
if (millis() > 100) //change this number to change alarm delay (1s = 1000ms)
{tone (8,1000); // change the second number to alter the tone of the peizo alarm
} else { noTone(8);}


All questions saying "urgent" are put at the bottom of the queue in order to handle all trivial questions first, and be serious about Your qúestion.
While You're waiting, read the first topics like "How to use forum", "How to attache code".

Try to break it down into individual sections for debugging. First be sure the hardware works and gives you what you expect, if it does not you code will never get it working. Top be honest it is a lot of code and I am not equipped to test it. I believe it is a Spark-Fun device and they offer a lot of help on there web site.


Put more print statements in so you can see where it is hanging. Start out by un-commenting what you have already.

Please read this:-
How to use this forum
Because your post is breaking the rules about posting code.


Other post/duplicate DELETED
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Continued cross posting could result in a time out from the forum.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.