Jump to content
  • 0

ic2 connection


nenadko

Question

hi,

i am using the uc32 board and am trying to set up an i2c connection with an accelometer http://www.st.com/web/catalog/sense_power/FM89/SC444/PF252716

i have the current version of mpide (mpide-0023-windows-20140821)

the code is pretty simple:

#include <Wire.h>

int addr = 0x1D;  //sensor adress

 

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

void loop() {
 
 Wire.beginTransmission(addr);
  Wire.send(0x0D);    //info register of the sensor
  int error = Wire.endTransmission();
 
  delay(50);
  Wire.requestFrom(addr, 1);
  delay(50);
 
 
  int test = Wire.receive();
 
  Serial.print("error: ");
  Serial.println(error);
  Serial.print("info: ");
  Serial.println(test);
}

Well, error has the value 4, which is defined as an "other" error in the wire library http://www.eecs.wsu.edu/~schneidj/chipKIT-reference/WireEndTransmission.htm. I have also tried the i2c scanner http://playground.arduino.cc/Main/I2cScanner - same problem.

Everything works fine with arduino ide and arduino boards.

Seems to be an problem with the wire library. I had similar problems with the arduino ide v1.5 which were solved in version 1.6.

Did anybody had similar problems and is there a simple solution?

thanks

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Hi nenadko,

From my understanding, there is a problem of some sort (I'm not sure what it is) with that particular build of MPIDE.

I have I2C working on both an older and newer version of MPIDE, you can view the whole list of builds here.

Let me know if you have any other questions.

Thanks,
JColvin

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...