Hello, I am a relative beginner in using arduino. I have set out to create a module using the Arduino Mega and OMRON MEMS D6T Thermal Sensor (more about it here) to detect the presence of a human nearby. I got it to successfully work about a year ago, using the code below. Recently, however, I have picked the project back up and for some reason, the only output I am getting is the value 14.26. I have thoroughly looked through the code to search for an error, and I have even tried replacing the sensor. It is still returning this value only. Would anyone be able to give me some insight as to how to go about solving this? Thanks in advance
My original code:
#include <Wire.h>
#include <SoftwareSerial.h>
#define D6T_ID 0x0A
#define D6T_CMD 0x4C
int ReadBuffer[35];
float ptat;
float tdata[16];
void setup()
{
Wire.begin();
Serial.begin(9600);
delay(500);
pinMode(A3, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(13, OUTPUT);
//pinMode(16, OUTPUT);
//pinMode(17, OUTPUT);
}
void loop()
{
int i;
//requesting data from sensor
Wire.beginTransmission(D6T_ID);
Wire.write(D6T_CMD);
Wire.endTransmission();
//recieving data
Wire.requestFrom(D6T_ID, 35);
Serial.println("TEST1");
for(i = 0; i<35; i++){
ReadBuffer[i] = Wire.read();
Serial.println("TEST2");
}
ptat = (ReadBuffer[0]+(ReadBuffer[1]*256))*0.1;
for(i = 0; i<16; i++){
Serial.println("TEST3");
tdata[i] = (ReadBuffer[(i*2+2)]+(ReadBuffer[(i*2+3)]*256))*0.1;
}
float tempF;
if( ((tdata[0]*9.0/5.0)+32.0) < 0){
for(i = 0; i<16; i++){
Serial.println("TEST4");
tempF = (tdata[i]*9.0/5.0)+32.0;
Serial.print(tempF);
Serial.print(',');
}
Serial.print((ptat*9.0/5.0)+32.0);
Serial.print(',');
Serial.println();
}
}