Hello, I am using the Sparkfun MS5803 in a project, it needs the I2C pins of the Arduino Uno, but I am already using those with a datalogger shield. My goal is to use I2C with other pins, I tried getting the SoftWire code from the SoftI2CMaster. to work with Sparkfun’s library. The Sparkfun library uses Wire.h, i changed it to use SoftWire.h. But I am getting multiple defition errors. I Changed both the original .ino code and the .cpp code like this:
#include <Wire.h> // Wire library is used for I2C #include "SparkFun_MS5803_I2C.h"
#define SDA_PORT PORTC #define SDA_PIN 4 // = A4 #define SCL_PORT PORTC #define SCL_PIN 5 // = A5 #include <SoftWire.h> // Wire library is used for I2C SoftWire Wire = SoftWire();
#include <Wire.h> #include <SparkFun_MS5803_I2C.h>
#define SDA_PORT PORTC #define SDA_PIN 4 // = A4 #define SCL_PORT PORTC #define SCL_PIN 5 // = A5 #include <Wire.h> SoftWire Wire = SoftWire();
And get errors like this one:
libraries\SparkFun_MS5803-14BA_Breakout_Arduino_Library-master\SparkFun_MS5803_I2C.cpp.o (symbol from plugin): In function `ass_i2c_delay_half': (.text+0x0): multiple definition of `Wire' sketch\SparkFun_MS5803_Demo.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
I have tried multiple things, but if I do not change the cpp file I get an error, if I change the .cpp and the .ino file as I showed i get multiple definition errors, then tried not declaring the cosntants in the .ino file or the .cpp file and got different errors. What can I do to make Sparkfun’s MS5803 to work with the SoftI2CMaster library?