Go Down

Topic: [Solved] Problem with wire.h when using custom libs. (Read 1 time) previous topic - next topic

instard

Mar 27, 2013, 05:16 am Last Edit: Mar 27, 2013, 01:32 pm by instard Reason: 1
I give up!  =( I need help now. Please help me why im gettings these errors. Im new here :)
Its a library for getting sensor values from a MPU6050 6 DOF.

project.ino
Code: [Select]

#include "IMU.h"
IMU imuController;

void setup() {
 imuController.init();
...


IMU.h
Code: [Select]

#include "Wire.h"
#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"
class IMU {
public:
IMU();
...


MPU6050_6Axis_MotionApps20.h
https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/MPU6050_6Axis_MotionApps20.h

I2C_Dev
https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/I2Cdev
errors:
Code: [Select]

/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)':
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp:278: error: 'class TwoWire' has no member named 'write'
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp:284: error: 'class TwoWire' has no member named 'read'
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)':
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp:418: error: 'class TwoWire' has no member named 'write'
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp:427: error: 'class TwoWire' has no member named 'read'
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp:430: error: 'class TwoWire' has no member named 'read'
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp: In static member function 'static bool I2Cdev::writeBytes(uint8_t, uint8_t, uint8_t, uint8_t*)':
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp:601: error: 'class TwoWire' has no member named 'write'
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp:607: error: 'class TwoWire' has no member named 'write'
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp: In static member function 'static bool I2Cdev::writeWords(uint8_t, uint8_t, uint8_t, uint16_t*)':
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp:651: error: 'class TwoWire' has no member named 'write'
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp:658: error: 'class TwoWire' has no member named 'write'
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/I2Cdev.cpp:659: error: 'class TwoWire' has no member named 'write'


File structure:

instard

changed:
Code: [Select]
#define I2CDEV_IMPLEMENTATION       I2CDEV_ARDUINO_WIRE

to
Code: [Select]
#define I2CDEV_IMPLEMENTATION       I2CDEV_ARDUINO0_WIRE

errors:
Code: [Select]










/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp:24:19: error: twi.h: No such file or directory
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp: In member function 'void TwoWire::begin()':
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp:60: error: 'twi_init' was not declared in this scope
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp: In member function 'void TwoWire::begin(uint8_t)':
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp:65: error: 'twi_setAddress' was not declared in this scope
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp:66: error: 'twi_attachSlaveTxEvent' was not declared in this scope
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp:67: error: 'twi_attachSlaveRxEvent' was not declared in this scope
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp: In member function 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)':
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp:83: error: 'twi_readFrom' was not declared in this scope
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp: In member function 'uint8_t TwoWire::endTransmission()':
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp:115: error: 'twi_writeTo' was not declared in this scope
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp: In member function 'void TwoWire::send(uint8_t)':
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp:143: error: 'twi_transmit' was not declared in this scope
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp: In member function 'void TwoWire::send(uint8_t*, uint8_t)':
/Users/user/Dropbox/Projects/Arduino/libraries/IMU/Wire.cpp:160: error: 'twi_transmit' was not declared in this scope

PaulS

There is a copy, in your directory, of the Arduino core library composed of Wire.cpp and Wire.h. You need to either get rid of them and possibly break that library, or get rid of the core Wire library and possibly break other sketches.


daisygrm

Can i ask how do you go about breaking the copy of the library or getting rid of it?
I was trying this stuff too and I encounter this problem,however it cant be resolved. Please help

Go Up