1 Reply Latest reply on Feb 4, 2014 3:35 PM by Clayton Hofrock

    i2c Sensors

    shaabangbang

      Hello,

       

      I've been trying to get the MLX90614 IR sensor to work with galileo. For some strange reason it just won't read from it, this is the code I'm using:

      #include "Wire.h"
      
      
      #define address 0x5a
      
      
      void setup() {
        // put your setup code here, to run once:
        Wire.begin();  // join i2c bus
        Serial.begin(9600);
      
      }
      void loop() {
        // put your main code here, to run repeatedly:
      
        Serial.print("Temperature: ");
        int temperature;
        Wire.write(0x00);
      
        Wire.requestFrom(address, 1);
      
        if(Wire.available()){
          temperature = Wire.read();
          Serial.println(temperature);
        } else {
          Serial.println("----");
        }
      
        Wire.endTransmission();
      
        delay(1000);
      }
      
      

       

      I'm not sure what I could be doing wrong.. I have the sensor connected to the SDA, SCL, GND and the 3v3 pins.