I am trying to read a sensor using I2C, i am new to this and i only keep getting response as -1.
Th steps described in the datasheet are as per the below images.
my code is as under:
#include <Wire.h>
int X0;
void setup() {
Wire.begin();
Serial.begin(9600);
delay(100);
Wire.beginTransmission(0xDA);
Wire.write(0x08);
Wire.endTransmission();
Wire.requestFrom(0xDB,1);
X0 = Wire.read();
Serial.print("X0= ");
Serial.print(X0);
Serial.print("\n");
delay (500);
}
void loop() {
}
I would appreciate inputs on how to get this done.
