Hi everyone,
I made a sketch to print data from the MLX90621 via I2C to the serial together with a timestamp and sampling time. It worked perfectly on the Arduino uno, but on the Due it gives a lot of problems.
Can someone help me with my problem? I already tried to change the wire library with searching on forums but than I get a compiling error.
Here is my code:
#include <Arduino.h>
#include "MLX90621_due.h"
#include <Wire.h>MLX90621 sensor;
void sendTemperatures(){
Serial.print(millis());
Serial.print(",");
for(int y=0;y<4;y++){ //go through all the rows
for(int x=0;x<16;x++){ //go through all the columns
Serial.print(sensor.getTemperature(y*4+x)); // extract the temperature at position x/y
Serial.print(",");}
}
Serial.print("\n");
}void setup(){
delay(500);
Serial.begin(230400);
sensor.setRefreshRate(RATE_32HZ);
sensor.setResolution(RES_15bit);
sensor.setEmissivity(0.8);
sensor.initialize ();
Serial.println(F("sensor initialized. LET'S GO!"));
delay(3000);
}void loop(){
long startTime = micros();sensor.measure(true); //
sendTemperatures();long elapsed = micros() - startTime;
Serial.print("measure time = ");
Serial.print((float)elapsed/1000);
Serial.println("ms");
}
See link for wiring. google drive link
Hope someone can help.