I'm learning how to read and write data using the wire interface at the moment, but as my question says I'm unsure if the code is interpretting the address as a hex value or decimal, for example:
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output
writeTo(DEVICE, 0x16, 8);
} // end of setup
Where writeTO is:
void writeTo(int device, byte address, byte val)
{
Wire.beginTransmission(device); //start transmission to device
Wire.write(address); // send register address
Wire.write(val); // send value to write
Wire.endTransmission(); //end transmission
} // end of writeTo
So, i'm using writeTo(DEVICE, 0x16, 8), how does it know that the 0x16 is hex and not decimal?
If you are changing different registers then you might want to make a function to read the register and only change the bits you want changed. Perhaps you will need args for what to & and what to | with the original data before writing back.