November 23, 2024, 01:51:14 AM

Arduino I2C and mod-tc-mk2-31855

Started by enricocas, May 23, 2013, 11:40:01 AM

Previous topic - Next topic

enricocas

Hi everybody,
I'm trying to interface an arduino to the MOD-TC-MK2-31855 sensor board, but I'm having many difficulties getting data. I post here the sketch I wrote. Is it correct, or am I doing something wrong?? I'm getting all 255 int values.
Thank you very much,



#include <Wire.h>

void setup(){
  pinMode(A4, INPUT);
  pinMode(A5, INPUT);
  Wire.begin();
  Serial.begin(9600);
}
void loop(){
  Wire.beginTransmission(byte(0x48));
  Wire.write(0x01);
  Wire.write(0xA0);
  Wire.write(byte(0x23));
  Wire.endTransmission();
  //Wire.beginTransmission(byte(0x48));
  Wire.requestFrom(0x48,4);
  //Wire.endTransmission();
  byte c[4];
  int i=0;
  Serial.print("Start geting data");
  while(Wire.available())
  {
    c[i] =Wire.read();
    Serial.print(int(c[i]));
    i++;
  }
  delay(1000);
}




maria_olimex

Software developer at Olimex