2

Here is the code I am using:

#define D6T_ID 0x0A
#define D6T_CMD 0x4C

int ReadBuffer[35];
float ptat;
float tdata[16];

#include <Wire.h>
void setup() {
  Wire.begin();
  Serial.begin(9600);
  delay(500);

}

void loop() {

}
  int i;
  Wire.beginTransmission(D6T_ID);
  Wire.write(D6T_CMD);
  Wire.endTransmission();

  Wire.requestFrom(D6T_ID,35);

  for (i=0; i<35; ++i) {
    ReadBuffer[i] = Wire.read();
  }

  ptat = (ReadBuffer[0]+(ReadBuffer[1]*256))*0.1; //Reference Temp

  for (i=0; i<16; ++i) {
    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)
    {
      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();
  }

    }
  }

This is the error I am getting:

exit status 1 'Wire' does not name a type

And it highlights this area of code:

Wire.requestFrom(D6T_ID,35);

I am completely new to using the arduino and coding so I am not sure if I already have the wire library that this code requires but when I look at the libraries in the Tools menu it is there. Do I need to download another library? If so can someone send me the link? Can someone explain what the error means? This is all foreign to me.

Thank you

  • ***** It should say #include <Wire.h> – Kri Nov 8 '16 at 0:41
  • Your braces are not right. For example, for the loop function you have an open brace and then a close brace before you code starts. – sa_leinad Nov 8 '16 at 0:57
2

You've goofed up your braces and none of that code is in loop(). Look at the braces in the code and make the appropriate corrections.

0

The reason for the error message is that your braces do not properly match, and the code that was meant to be inside loop() is not, but instead looks to the compiler like some new global declarations. Fix the syntax errors and your code will compile:

  • Remove the brace in line 18 that closes the loop() function prematurely,
  • Fix the missing ')' in line 46,
  • Remove line 52, an extraneous '}',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.