• Ok, thanks! I think what might be happening is the readWord/readByte isn't working properly - they're just effectively reading from address 0. It could be because the sensor resets if it receives a STOP I2C signal between packets...

    Please could you try:

    mpr.readWord = function(reg) {
          i2c.writeTo({address:0x5A, stop:false}, reg);
          var data = i2c.readFrom(0x5A, 2);
          return (data[1] << 8) || data[0];
        };
    mpr.readByte = function(reg) {
          i2c.writeTo({address:0x5A, stop:false}, reg);
          return i2c.readFrom(0x5A, 1)[0];
        };
    
About

Avatar for Gordon @Gordon started