I am trying to read a specific register from a device. In this case I am trying to read the value stored in register 0X1F from slave device 0x08. On the scope I see writes for
ADDRESS_SLAVE(Wire.beginTransmission), ADDRESS_TESTCOMP0 (Wire.write)
and
ADDRESS_TESTCOMP0 (Wire.requestFrom(ADDRESS_TESTCOMP0,8))
but I don't see the register values reading out. Here is my code:
#include <Wire.h>
int ADDRESS_SLAVE = 0X08;
int ADDRESS_TESTCOMP0 = 0X1F;
void setup()
{
Wire.setClock(3400000);
Wire.begin();
Serial.begin(9600);
}
void loop()
{
Wire.beginTransmission(byte(ADDRESS_SLAVE));
Wire.write(byte(ADDRESS_TESTCOMP0));
Wire.endTransmission(byte(ADDRESS_TESTCOMP0));
Wire.requestFrom(ADDRESS_TESTCOMP0,8);
char read = Wire.read();
Serial.println(read);
delay(1000);
}
code..... select the code text and click{}..... or just indent each line by 4 more spaces