Quantcast
Channel: Intel Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 41305

i2c Sensors

$
0
0

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.


Viewing all articles
Browse latest Browse all 41305

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>