The snippet below is from the getTemperature method
Wire.requestFrom((uint8_t)MPL3115A2_ADDRESS, (uint8_t)2);// send data n-bytes read
t = Wire.read(); // receive DATA
t <<= 8;
t |= Wire.read(); // receive DATA
t >>= 4;
Here's how I did it in Lua
t = i2c.read(0, 1)
t1 = bit.lshift(t, 8)
t2 = bit.bor(t1, i2c.read(0, 1))
t3 = bit.rshift(t2, 4)
*drumroll* It doesn't work. I'm sure that I have problems in other places as well, it's mainly with the Wire.
I'd like to get some input for this.