Hi,
I’m trying to port the I2C-Library from Francisco Malpartida to spark core but I fail at the very first line,…
I2CIO.cpp: In member function 'int I2CIO::begin(uint8_t)':
I2CIO.cpp:65:4: error: 'Wire' was not declared in this scope
Wire.begin ( );
I hope you can give me a hint how I can proceed. I included some code snippets, hope they are enough to identify the issue.
Main Application:
#define SPARK_CORE 2
#include "LiquidCrystal_I2C.h" /* which includes application.h and I2CIO.h */
void setup()
{
Wire.begin(); // join i2c bus
}
void loop()
{
}
I2CIO.cpp:
#include "application.h"
#include "I2CIO.h"
I2CIO::I2CIO ( )
{
_i2cAddr = 0x0;
_dirMask = 0xFF; // mark all as INPUTs
_shadow = 0x0; // no values set
_initialised = false;
}
int I2CIO::begin ( uint8_t i2cAddr )
{
_i2cAddr = i2cAddr;
Wire.begin ( );
_initialised = Wire.requestFrom ( _i2cAddr, (uint8_t)1 );
_shadow = Wire.receive ();
return ( _initialised );
}
Kind regards