I am attempting to get readings off a sensor using an Arduino 2560 using a certain I2C communication protocol described in the picture however my code only displays a single value of 130 regardless of what the code actually is. The sensor can pick up temperature and force. The address of the force's data is the 0x57 and the sensor address is 00000001. How do I remedy this? Any help is appreciated!
My code:
#include <Wire.h>
void setup() {
Serial.begin(9600); // begin serial comm.
Wire.begin(); //join i2c bus as master
}
void loop() {
Serial.println("Force Reading:");
Wire.beginTransmission(0x01); // Establish contact with 00000001b
Wire.write(0x57); // Tell 00000001b to retrieve data type 0x57
Wire.endTransmission(); //Ends transmission.
Wire.requestFrom(0x01, 5); // Transfer data type 0x57 to Arduino
int data = Wire.read(); // Read the transferred data
Serial.println(data); // Print the data to the serial monitor
delay(1000);
}