MS5837.h compiling issues

Hi! I’m Fernando Fonseca, I’m trying to compile the example code for the Bar30 pressure sensor in Arduino Mega but I have this error:

"In file included from pressure_sensor_test.ino:2:0: C:\Users\Fernando\Documents\Arduino\libraries\BlueRobotics_MS5837_Library-master/MS5837.h:44:9: error: 'constexpr' does not name a type static constexpr float Pa = 100.0f; ^ C:\Users\Fernando\Documents\Arduino\libraries\BlueRobotics_MS5837_Library-master/MS5837.h:44:9: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 C:\Users\Fernando\Documents\Arduino\libraries\BlueRobotics_MS5837_Library-master/MS5837.h:45:9: error: 'constexpr' does not name a type static constexpr float bar = 0.001f; ^ C:\Users\Fernando\Documents\Arduino\libraries\BlueRobotics_MS5837_Library-master/MS5837.h:45:9: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 C:\Users\Fernando\Documents\Arduino\libraries\BlueRobotics_MS5837_Library-master/MS5837.h:46:9: error: 'constexpr' does not name a type static constexpr float mbar = 1.0f; ^ C:\Users\Fernando\Documents\Arduino\libraries\BlueRobotics_MS5837_Library-master/MS5837.h:46:9: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 Error de compilación"
It compiles for Arduino Due but not for Arduino MEGA, How can I solve It?

I’ve upgraded my Arduino version to the 1.6.9 ide and it worked well. Why not in the 1.6.2 version?

Now the sensor is NOT working I’ll wait for the level converter to prevent damage it.

Hi Fonz,

Arduino 1.6.2 and below don’t support constexpr but it’s needed in 1.6.9. Our code is written to support the most recent versions of Arduino.

I’m glad you’re waiting for the level converter. That’s important.


What is the purpose of constexpr? Thank you for your support!!

i´m trying with the arduino mega too, and have the same errors of Fonz. what is the level converter?do someone have a video making proof with the sensor?my email is

Hi Viviana,

Please make sure you are using the most recent version of Arduino for it to compile correctly.

The level converter changes the 5V signal level from the Arduino to 3.3V signal level for the sensor. This is required as the sensor is not rated to handle 5V signals. Here is a level converter that will work well:

What exactly do you want a video of? Can you explain?


hi rusty! thnx for reply!

the arduino have a 3.3V pin, that´s why i didn´t make the level converter in the sensor board. the 3.3 V pin don´t work?

about the video, i want to see something like this but with the ms5837


Hi Viviana,

The Arduino has a 3.3V pin, but that is for power only. The SDA and SCL signals for I2C are still sent at 5V, which could damage the sensor. I know it’s a bit confusing, but I would strongly recommend getting a logic level converter.

That is a cool video. We’ll try to get something similar. We frequently test them in a cup of water and you can clearly and accurately measure the depth of the cup.


oh!thnx for that information rusty!!!there’s no enough information about this sensor, so thnx so much!i´ll put the level converter.



We’ll try to make that more clear on our product page! We’re also working on a custom level converter that you can plug the sensor directly into. That’ll make it much easier.


that will be a great idea!