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
@user7143 started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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.
https://www.sparkfun.com/products/11931