Here a little example. I clean and reduce a little bit the code. Some var definitions are not needed.
/* Copyright (c) 2014 ToDo */ /* Quick description ToDO */ var C = { ADDRESS : 0x48 // description }; /** * Description */ function TMP102(_i2c) { this.i2c = _i2c; } /** * Description */ TMP102.prototype.getTemperature = function() { var d = this.i2c.readFrom(C.ADDRESS, 2); return (((d[0] << 8) | d[1]) >> 4)*0.0625; }; /** * export */ exports.connect = function (_i2c) { return new TMP102(_i2c); };
@possmann 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.
Here a little example. I clean and reduce a little bit the code. Some var definitions are not needed.