I might have to monkey with the reporting format. Right now it assumes two elements for each reporting pin on an array (in string format) with length n*2 where n is the number of reporting pins.
With I2C we have to add in the address of the reporting device.
I could reflect what I did on the payload side and separate reporting pins with a pipe, split on the pipe, and then split the resulting elements on commas. Those second elements with length === 3 are I2C.
First Things first though: I’m going to play with multiple sensors on an Arduino, port that to the Imp and then try I2C sensors on an Arduino and then port that to Imp. I really haven’t played with sensors enough to feel confident architecting this just yet.
[2, 228, 251, 40, 62, 72, 242, 16, 253, 0, 1, 70, 255, 59]when the device is at rest and room temperature. With reads from the Imp under the same conditions I’m seeing values like
[0, 0, 0, 0, 1, 65, 232, 1, 0, 243, 92, 245, 128, 255]and they bounce around a lot (like I’m not reading the same registers each time). I even hard coded the read command and listened to the response in Squirrel to take out any confusion along the way but I got the same incorrect results.
register = “0x3B”;is actually
register = 0x3B.tostring();
i2c_addr = pin << 1; register = 0x3B.tostring(); numbytes = pin.tointeger(); local result = i2c.read(i2c_addr, register, numbytes);