You are reading a single comment by @user7143 and its replies. Click here to read the full conversation.
  • I created this module today. It allows Espruino board to interface with a TMP102 temperature sensor. It is accurate down to 0.0625 of a degree.

    I2C1.setup({scl:B6,sda:B7});
    var TMP102 = require("tmp102").connect(I2C1);
    console.log(TMP102.getTemperature());
    
     
    function TMP102(_i2c) {
        this.i2c = _i2c;
        this.address = 0x48;   
    }
    
    TMP102.prototype.getTemperature = function() {
        var self = this;  
        var d = self.i2c.readFrom(self.address, 2);
        var temp = (((d[0] << 8) | d[1]) >> 4)*0.0625; 
        return temp;
    };
    
    
    exports.connect = function (_i2c) {
        return new TMP102(_i2c);
    };
    

    https://www.sparkfun.com/products/11931

About

Avatar for user7143 @user7143 started