Omron d6t440l

Hi, I am a student currently working on a project on D6t440l I copied a code for interfacing the sensor.
I want to drive a motor when the temperature is high around 35 degrees or any number I'm having difficulty interfacing it that way so kindly Iike a solution to how I can set the temperature to drive my motor.

Thank You,

#include <Wire.h>
#include <WireExt.h>

#define D6T_addr 0x0A // Address of OMRON D6T is 0x0A in hex
#define D6T_cmd 0x4C // Standard command is 4C in hex

int rbuf[35]; // Actual raw data is coming in as 35 bytes. Hence the needed for WireExt so that we can handle more than 32 bytes
int tdata[16]; // The data comming from the sensor is 16 elements, in a 16x1 array
float t_PTAT;

void setup()
{
Wire.begin();
Serial.begin(9600);

pinMode(13, OUTPUT);
}

void loop()
{
int i;
// Begin a regular i2c transmission. Send the device address and then send it a command.
Wire.beginTransmission(D6T_addr);
Wire.write(D6T_cmd);
Wire.endTransmission();
delay(100);

// This is where things are handled differently. Omron D6T output data is 35 bytes and there is a limit here on what Wire can receive. We use WireExt to read the output data 1 piece at a time. We store each byte as an element in rbuf.
if (WireExt.beginReception(D6T_addr) >= 0) {
i = 0;
for (i = 0; i < 35; i++) {
rbuf = WireExt.get_byte();

  • }*

  • // end the reception routine*

  • WireExt.endReception();*

  • // Do something with temperature compensation that we don't seem to use currently.*
    t_PTAT = (rbuf[0]+(rbuf[1]<<8))*0.1;

  • // Calculate the temperature values: add the low temp and the bit shifted high value together. Multiply by 0.1*

  • for (i = 0; i < 16; i++) {*
    tdata_=(rbuf[(i2+2)]+(rbuf[(i2+3)]<<8))0.1;_
    _
    } _
    _
    }*_

* // Use a for loop to output the data. We can copy this from serial monitor and save as a CSV*
* for (i=0; i<16; i++) {*
_ Serial.print(tdata*);
Serial.print(",");
}
Serial.print("\n");*_

* delay(100); *
}

No link to the used hardware, no code tags around the posted code. Did you actually read the sticky post at the top of the topic?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.