I'm taking a shot at my first library and I'm getting a this error
LeakSensors.cpp: In constructor 'Leaksensor::Leaksensor()':
LeakSensors.cpp:12: error: 'I2c' was not declared in this scope
I have 3 tabs in my sketch
IC2_Master_DSS_Lib.ino
LeakSensors.cpp
LeakSensor.h
All three of these files are in the \IC2_Master_DSS_Lib\ folder
My sketch also uses an I2c.h library with is in my \library\ folder
I had a working sketch with just a .ino file, no LeakSensors.cpp or LeakSensor.h at that point. In that original sketch, I just had to include the I2c.h library: #include <I2C.h>, and I could use the i2c functions in it, like I2c.begin();
But now with my three files, the IDE doesn't seem to be including the I2c.h library.
In IC2_Master_DSS_Lib.ino I have
#include "LeakSensors.h"
Leaksensor sensorInfo; // initialize Leaksensor class
void setup ()
{
Serial.begin(9600);
Serial.println(F("Initialize library for I2C Master Test"));
}
...
In LeakSensors.cpp I have
#include "LeakSensors.h"
#include <I2C.h> // https://github.com/rambo/I2C
#define PACKET_SIZE sizeof(sensorData_t)
Leaksensor::Leaksensor() // Constructor
{
// Initialize I2C
I2c.begin(); // enables the I2C hardware
I2c.timeOut(10000);
}
...
In LeakSensor.h I have
#include "Arduino.h"
class Leaksensor
{
public:
...
There's more to each sketch then posted above (see attachments for complete code)
I've tried including I2c with double quotes instead of brackets. And I've moved it to different files, but I still get the this error.
I2C.h (4.54 KB)
I2C_Master_DSS_Lib.ino (1.2 KB)
LeakSensors.cpp (1.54 KB)
LeakSensors.h (1.13 KB)