I am trying to adapt a MS5837 pressure sensor to work with the Particle Electron. I am just trying to get the library’s test code to work but I am running into this error when I try to compile. This code compiles and works just fine on Arduino but doesn’t seem to work with Particle. The code I am trying to run along with the .h and .cpp can be found on github via:
The full error message with its context in the raw output - or at least a filename and line number - would be helpful.
If you used Web IDE providing a project snapshot via the SHARE THIS REVISION button in the IDE would avoid the necessity to piece together some test project in order to see your actual problem.
But some things I have noticed in that library. It uses variables like
D2 but these are already used as macros to define the pin names on the Particle devices. So that’s most likely the problem you are seeing.
Thank you for your help! I renamed the variables in the library from D1 and D2 to R1 and R2 respectively. I am now getting a different series of errors.
I know that Wire is a library inherent to Arduino. Do I need to add the Wire.h folder along with other dependencies from my Arduino install to my project directory? Or does particle offer an alternative?
On Particle devices there is no
Wire.h file. But via
#include <Particle.h> you can include all HW features the devices have on board.
If you are targeting a system version >= 0.6.3 you can
#include <Arduino.h> (before any other include) which will provide you with extensive compatibility macros that make porting Arduino libraries much easier.