Skip to main content
added 67 characters in body
Source Link

I have Arduino mega and Lego temperature sensor which I would like to connect to the Arduino. I'm trying to use a I2C connection between them, with no luck. I connected the sensor and Arduino referring to the picture below:wiring I'm using the Wire library for transmitting data. This is my code currently:

#include < Wire.h > byte ADDRESS=0x98; byte CONFIG=0x01; void setup(){ Serial.begin(9600); Wire.begin(); Wire.beginTransmission(ADDRESS); Wire.write(CONFIG); Wire.endTransmission(); delay(100); } void loop(){ Wire.beginTransmission(ADDRESS); Wire.write(CONFIG); Wire.endTransmission(); Wire.requestFrom(ADDRESS,2); delay(100); int avail=Wire.available(); Serial.println(avail); delay(100); }

#include < Wire.h >
byte ADDRESS=0x98;
byte CONFIG=0x01;
void setup(){
  Serial.begin(9600);
  Wire.begin();
  Wire.beginTransmission(ADDRESS);
  Wire.write(CONFIG);
  Wire.endTransmission();
  delay(100);
}
void loop(){
  Wire.beginTransmission(ADDRESS);
  Wire.write(CONFIG);
 Wire.endTransmission();
  Wire.requestFrom(ADDRESS,2);
  delay(100);
  int avail=Wire.available();
  Serial.println(avail);
  delay(100);
}

I found the config and address values from RobotC drivers for the same sensor. But all I get is zeros. Is there any way i could check for a defect sensor? Is my code correct?

I have Arduino mega and Lego temperature sensor which I would like to connect to the Arduino. I'm trying to use a I2C connection between them, with no luck. I connected the sensor and Arduino referring to the picture below:wiring I'm using the Wire library for transmitting data. This is my code currently:

#include < Wire.h > byte ADDRESS=0x98; byte CONFIG=0x01; void setup(){ Serial.begin(9600); Wire.begin(); Wire.beginTransmission(ADDRESS); Wire.write(CONFIG); Wire.endTransmission(); delay(100); } void loop(){ Wire.beginTransmission(ADDRESS); Wire.write(CONFIG); Wire.endTransmission(); Wire.requestFrom(ADDRESS,2); delay(100); int avail=Wire.available(); Serial.println(avail); delay(100); }

I found the config and address values from RobotC drivers for the same sensor. But all I get is zeros. Is there any way i could check for a defect sensor? Is my code correct?

I have Arduino mega and Lego temperature sensor which I would like to connect to the Arduino. I'm trying to use a I2C connection between them, with no luck. I connected the sensor and Arduino referring to the picture below:wiring I'm using the Wire library for transmitting data. This is my code currently:

#include < Wire.h >
byte ADDRESS=0x98;
byte CONFIG=0x01;
void setup(){
  Serial.begin(9600);
  Wire.begin();
  Wire.beginTransmission(ADDRESS);
  Wire.write(CONFIG);
  Wire.endTransmission();
  delay(100);
}
void loop(){
  Wire.beginTransmission(ADDRESS);
  Wire.write(CONFIG);
 Wire.endTransmission();
  Wire.requestFrom(ADDRESS,2);
  delay(100);
  int avail=Wire.available();
  Serial.println(avail);
  delay(100);
}

I found the config and address values from RobotC drivers for the same sensor. But all I get is zeros. Is there any way i could check for a defect sensor? Is my code correct?

Source Link

Using Lego temperature sensor with Arduino

I have Arduino mega and Lego temperature sensor which I would like to connect to the Arduino. I'm trying to use a I2C connection between them, with no luck. I connected the sensor and Arduino referring to the picture below:wiring I'm using the Wire library for transmitting data. This is my code currently:

#include < Wire.h > byte ADDRESS=0x98; byte CONFIG=0x01; void setup(){ Serial.begin(9600); Wire.begin(); Wire.beginTransmission(ADDRESS); Wire.write(CONFIG); Wire.endTransmission(); delay(100); } void loop(){ Wire.beginTransmission(ADDRESS); Wire.write(CONFIG); Wire.endTransmission(); Wire.requestFrom(ADDRESS,2); delay(100); int avail=Wire.available(); Serial.println(avail); delay(100); }

I found the config and address values from RobotC drivers for the same sensor. But all I get is zeros. Is there any way i could check for a defect sensor? Is my code correct?