Compilation Error: Pressure sensor(Example code) with Arduino Giga

Hi everyone,

I’m currently working on a project using a Bar02 Ultra High Resolution 10m Depth/Pressure Sensor with Arduino Giga R1 board .I tested the sensor with the Example code However, I’ve run into a compilation error that I’m having trouble resolving. I hope someone here can help me troubleshoot this issue.

Issue Description: I’m receiving the following compilation error message:


                 from C:\Users\name\AppData\Local\Temp\arduino\sketches\90D53A60B39CA0C658F2351B46E514C4\sketch\MS5837_Example.ino.cpp:1:
C:\Users\name\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pins_arduino.h:71:14: error: expected unqualified-id before numeric constant
 #define D1  (1u)
C:\Users\name\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pins_arduino.h:71:14: note: in definition of macro 'D1'
 #define D1  (1u)
C:\Users\name\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pins_arduino.h:71:14: error: expected ')' before numeric constant
 #define D1  (1u)
C:\Users\name\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pins_arduino.h:71:14: note: in definition of macro 'D1'
 #define D1  (1u)
exit status 1
Compilation error: exit status 1

Additional Information:

  • Arduino IDE Version: 2.2.1
  • Arduino Board: Arduino GIGA R1 WiFi
  • Board Package: Arduino Mbed OS Giga Boards version 4.0.8
  • Libraries in Use: MS5837 Arduino Library.

Steps Taken :I’ve verified that my code was working on a different board package (Arduino Mega), so the issue seems to be specific to the “mbed_giga” package.

Thank you in advance for your assistance!

Sooraj R

Hi @Sooraj_R, welcome to the Blue Robotics forums :slight_smile:

Given your compilation errors are inside your mbed_giga files, that does appear to be the case. Unfortunately that’s not a board I’m familiar with, so I’m not sure why the board definition files are apparently failing to compile. Your best bet is likely asking on the GIGA R1 category of the Arduino forums :slight_smile:

I managed to make it work in arduino giga by copy pasting the library code to arduino ide and running it.
But there is another problem, when i’m reading the data from pressure sensor it giving some error data.

14:24:00.352 → Pressure: 1013.02 mbar

14:24:00.352 → Temperature: 30.84 deg C

14:24:00.352 → Depth: 0.00 m

14:24:00.352 → Altitude: 1.91 m above mean sea level

14:24:00.387 → Pressure: 1013.01 mbar

14:24:00.387 → Temperature: 30.84 deg C

14:24:00.387 → Depth: 0.00 m

14:24:00.387 → Altitude: 2.00 m above mean sea level

14:24:00.435 → Pressure: 1013.00 mbar

14:24:00.435 → Temperature: 30.84 deg C

14:24:00.435 → Depth: 0.00 m

14:24:00.435 → Altitude: 2.08 m above mean sea level

14:24:00.480 → Pressure: 422.91 mbar

14:24:00.480 → Temperature: -447.74 deg C

14:24:00.480 → Depth: -6.04 m

14:24:00.480 → Altitude: 6786.87 m above mean sea level

14:24:00.513 → Pressure: -1822.43 mbar

14:24:00.513 → Temperature: 30.73 deg C

14:24:00.513 → Depth: -29.00 m

14:24:00.513 → Altitude: nan m above mean sea level

14:24:00.545 → Pressure: 1013.06 mbar

14:24:00.545 → Temperature: 30.78 deg C

14:24:00.545 → Depth: 0.00 m

14:24:00.545 → Altitude: 1.58 m above mean sea level

14:24:00.591 → Pressure: -1822.25 mbar

14:24:00.591 → Temperature: 30.69 deg C

14:24:00.592 → Depth: -29.00 m

14:24:00.592 → Altitude: nan m above mean sea level

Glad to hear you managed to get it working :slight_smile:

If you’re using our library code then I’m not sure how or why you would end up with negative pressure values unless the sensor has an unstable/insufficient power supply, or it is damaged/defective.

It may help to add a delay between readings and/or slow down the communication baudrate, but if not I’d recommend contacting our support email ( and letting them know what’s going on and the order number (or at least rough order date) for your sensor, to discuss how to proceed from here.