To start: I'm a newbie, still trying to find out how the Arduino Due works.
At this moment I'm trying to get a MLX90614-BAA communicating with my Due board. The problem already starts during the compiling of the project. First I was having problems to find the include files, but that has been solved (so far :P).
In Arduino 1.5.1r2 I still get the following errors:
C:\Users\kazimier\Documents\Arduino\libraries\I2Cmaster\I2C.cpp: In member function 'void I2C::begin()':
C:\Users\kazimier\Documents\Arduino\libraries\I2Cmaster\I2C.cpp:91: error: 'PORTD' was not declared in this scope
C:\Users\kazimier\Documents\Arduino\libraries\I2Cmaster\I2C.cpp:91: error: '_SFR_BYTE' was not declared in this scope
etc.
I can't figure out what goes wrong. I've articles about adjusting twimaster.cpp (or do I need to adjust the I2C.cpp)?
...\arduino-1.5.1r2\libraries\I2C\I2C.cpp: In member function 'void I2C::begin()':
...\arduino-1.5.1r2\libraries\I2C\I2C.cpp:91: error: 'PORTD' was not declared in this scope
...\arduino-1.5.1r2\libraries\I2C\I2C.cpp:91: error: '_SFR_BYTE' was not declared in this scope
...\arduino-1.5.1r2\libraries\I2C\I2C.cpp:91: error: '_BV' was not declared in this scope
...\arduino-1.5.1r2\libraries\I2C\I2C.cpp:95: error: 'TWSR' was not declared in this scope
...\arduino-1.5.1r2\libraries\I2C\I2C.cpp:95: error: 'TWPS0' was not declared in this scope
Can somebody help with this?
Thanks in advance for your help!!
Easy enough. The library appears to be written for the AVR Arduinos, accessing ports directly rather than making library calls. That code will not work with the Due as it is a different architecture. You'll need to figure out what that code is trying to do and recode it.
This is common in many libraries as people took shortcuts to get more horsepower out of the smaller units. It makes getting the hardware working on Due a painful process.
Thanks for your answers!
I looked into the discussion that veneridesign suggested and there they point out that there is an error in the wire library. I am trying to fix this problem to use the offical wire library but I am not able to check if the changes (in red color) I've made work in the Wire.cpp file. Can someone check if they work??
Additionally, the sensor uses the following protocol (see attached image). Do you know how can I get this sequence with the standard functions of the library (begin, write, read, request answer...)?