Can't read data from registers using I2C I am trying to read data from the registers 6, 7, 8 and 9 of the STC3100 (Data Sheet) using an arduino uno.
I followed this tutorial: https://howtomechatronics.com/tutorials/arduino/how-i2c-communication-works-and-how-to-use-it-with-arduino/ And adjusted the device and register adress accordingly.
This isn't working and instead of returning the data on the register I'm just getting 16 over and over again.
Here is my code:
#include &lt;Wire.h&gt;
int ADXLAddress = 0x70; 

#define X_Axis_Register_DATAX0 0x08 

#define X_Axis_Register_DATAX1 0x09 

#define Power_Register 0x00 

int X0,X1,X_out;

void setup() {

  Wire.begin(); 

  Serial.begin(9600);
  delay(100);
  Wire.beginTransmission(ADXLAddress);
  Wire.write(Power_Register);
  Wire.write(16);  
  Wire.endTransmission();
}
void loop() {
  delay(2000);
  Wire.beginTransmission(ADXLAddress);  
  
  Wire.write(X_Axis_Register_DATAX0);
  Wire.write(X_Axis_Register_DATAX1);
  
  Wire.endTransmission();

  Wire.requestFrom(ADXLAddress,2); 
  
  if(Wire.available()&lt;=2) {  
    X0 = Wire.read(); 
    X1 = Wire.read();   
  }
  
  Serial.print(&quot;X0= &quot;);
  Serial.print(X0, BIN);
  Serial.print(&quot;   X1= &quot;);
  Serial.println(X1, BIN);
}
The following code shows, how I would read from a STC3100. But I own none of them, so I can not try the code. I would be very surprised if it works directly. Use it as an example. Perhaps we could improve it together. ;-)
#include &lt;Wire.h&gt;

#define STC_ADDRESS 0x70
#define MODE_REGISTER 0x00 
#define CURRENT_LOW_REGISTER 0x06 
#define VOLTAGE_LOW_REGISTER 0x08 

int voltage, current;
int high_value = 0;

void setup() 
{
  Serial.begin(9600);

  Wire.begin(); 
  delay(100);
  // power on the STC
  Wire.beginTransmission(STC_ADDRESS);
  Wire.write(MODE_REGISTER);
  Wire.write(16);  
  Wire.endTransmission();
}

void loop() 
{
  Wire.beginTransmission(STC_ADDRESS); 
  Wire.write(VOLTAGE_LOW_REGISTER);
  Wire.requestFrom(STC_ADDRESS, 2); 
  delay(500);
  if( Wire.available() &gt; 0 ) 
  {          
    voltage = Wire.read(); 
    //Serial.print(&quot;REG 8 = &quot;);
    //Serial.println(voltage);
  }
  delay(500);
  if( Wire.available() &gt; 0 ) 
  {  
    high_value = Wire.read();
    //Serial.print(&quot;REG 9 = &quot;);
    //Serial.println(high_value);
    voltage += (high_value &lt;&lt; 8);   
    //Serial.print(&quot;voltage = &quot;);
    //Serial.println(voltage);

  }
  Wire.endTransmission();

  Wire.beginTransmission(STC_ADDRESS); 
  Wire.write(CURRENT_LOW_REGISTER);
  Wire.requestFrom(STC_ADDRESS, 2); 
  delay(500);
  if( Wire.available() &gt; 0 ) 
  {  
    current = Wire.read(); 
    //Serial.print(&quot;REG 6 = &quot;);
    //Serial.println(current);
  }
  delay(500);
  if( Wire.available() &gt; 0 ) 
  {  
    high_value = Wire.read();   
    //Serial.print(&quot;REG 7 = &quot;);
    //Serial.println(high_value);
    current += (high_value &lt;&lt; 8);   
    //Serial.print(&quot;current = &quot;);
    //Serial.println(current);
  }
  Wire.endTransmission();

  Serial.print(&quot;V= &quot;);
  Serial.print(voltage);
  Serial.print(&quot;   C= &quot;);
  Serial.println(current);
}