Hello! I'm having a problem with the Infrared Thermometer that i bought i tried using so many different libraries for it but i think it needs i2cmaster.
This is the Thermometer Model: http://circuit.rocks/image/cache/product/Infrared-Thermometer/infrared-thermometer-1-500x500.jpg
and this is the wiring i followed: http://www.elecrow.com/wiki/images/thumb/7/7e/MLX90614_Breakout_Board_hardware.jpg/500px-MLX90614_Breakout_Board_hardware.jpg
Except that i use an Arduino DUE so i have my SDA and SCL pins connected to pin 20 and 21 of my DUE
I use this code
#include <i2cmaster.h>
void setup(){
Serial.begin(9600);
Serial.println("Setup...");
i2c_init(); //Initialise the i2c bus
PORTC = (1 << PORTC4) | (1 << PORTC5);//enable pullups
}
void loop(){
int dev = 0x5A<<1;
int data_low = 0;
int data_high = 0;
int pec = 0;
i2c_start_wait(dev+I2C_WRITE);
i2c_write(0x07);
// read
i2c_rep_start(dev+I2C_READ);
data_low = i2c_readAck(); //Read 1 byte and then send ack
data_high = i2c_readAck(); //Read 1 byte and then send ack
pec = i2c_readNak();
i2c_stop();
//This converts high and low bytes together and processes temperature, MSB is a error bit and is ignored for temps
double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)
double tempData = 0x0000; // zero out the data
int frac; // data past the decimal point
// This masks off the error bit of the high byte, then moves it left 8 bits and adds the low byte.
tempData = (double)(((data_high & 0x007F) << 8) + data_low);
tempData = (tempData * tempFactor)-0.01;
float celcius = tempData - 273.15;
float fahrenheit = (celcius*1.8) + 32;
Serial.print("Celcius: ");
Serial.println(celcius);
Serial.print("Fahrenheit: ");
Serial.println(fahrenheit);
delay(1000); // wait a second before printing again
}
and get this error which i am not familiar with and do not know how to fix
Arduino: 1.6.5 (Windows 7), Board: "Arduino Due (Programming Port)"
In file included from MLX90614.ino:1:0:
C:\Users\TOSHIBA\Desktop\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\libraries\I2Cmaster/i2cmaster.h:88:20: fatal error: avr/io.h: No such file or directory
#include <avr/io.h>
^
compilation terminated.
Error compiling.
I have put both I2Cmaster and MLX90614 folder in my libraries folder. Why can't i use the i2cmaster library on my due?