function MCP9808( i2c, a2a1a0Pins ) {
    this.i2c = i2c;

    // calculate I2C address from base address and selected pins A0, A1, A2
    this.i2cAddress = C.I2CADDR_BASE | ((a2a1a0Pins || 0) & 0x07);

    // read and check manufacturer id
    if (this.read16( C.REG_MANUFACTURER_ID ) !== 0x54) {
        throw Error( "Invalid Manufacturer ID" );
    }

    // read and check device id and revision
    var deviceIdRevision = this.read16( C.REG_DEVICE_ID_REVISION );
    if ((deviceIdRevision & 0xff00) !== 0x0400) {
        throw Error( "Invalid Device ID" );
    }
    // deviceIdRevision & 0xff == chip revision, but until now it is always 0.
}
/**
 * Create a new MCP9808 sensor
 * @param i2c   I2C instance
 * @param a2a1a0Pins optional configuration of the address pin A2 A1 A0, e.g. 0b101
 *                   0b00 if omitted
 */
Create a new MCP9808 sensor
@param i2c   I2C instance
@param a2a1a0Pins optional configuration of the address pin A2 A1 A0, e.g.
Create a new MCP9808 sensor @param i2c I2C instance @param a2a1a0Pins optional configuration of the address pin A2 A1 A0 e . g .
function MCP9808( i2c, a2a1a0Pins ) {
    this.i2c = i2c;
    this.i2cAddress = C.I2CADDR_BASE | ((a2a1a0Pins || 0) & 0x07);
    if (this.read16( C.REG_MANUFACTURER_ID ) !== 0x54) {
        throw Error( "Invalid Manufacturer ID" );
    }
    var deviceIdRevision = this.read16( C.REG_DEVICE_ID_REVISION );
    if ((deviceIdRevision & 0xff00) !== 0x0400) {
        throw Error( "Invalid Device ID" );
    }
}
function MCP9808 ( i2c , a2a1a0Pins ) { this . i2c = i2c ; this . i2cAddress = C . I2CADDR_BASE | ( ( a2a1a0Pins || 0 ) & 0x07 ) ; if ( this . read16 ( C . REG_MANUFACTURER_ID ) !== 0x54 ) { throw Error ( "Invalid Manufacturer ID" ) ; } var deviceIdRevision = this . read16 ( C . REG_DEVICE_ID_REVISION ) ; if ( ( deviceIdRevision & 0xff00 ) !== 0x0400 ) { throw Error ( "Invalid Device ID" ) ; } }
Create a new MCP9808 sensor
 @param i2c   I2C instance
 @param a2a1a0Pins optional configuration of the address pin A2 A1 A0, e.g.
Create a new MCP9808 sensor @param i2c I2C instance @param a2a1a0Pins optional configuration of the address pin A2 A1 A0 e . g .
// calculate I2C address from base address and selected pins A0, A1, A2 // read and check manufacturer id // read and check device id and revision // deviceIdRevision & 0xff == chip revision, but until now it is always 0.