newbie Q on getting data from connected i2c device
Does anyone here know how to read data from an i2c device? I can't seem to figure it out. I'm looking at the i2c API here
https://mbientlab.com/androiddocs/latest/i2c.html
And the i2c interface info for my sensor here (page 9):
http://www.robotshop.com/media/files/pdf/MS5837-30BA.pdf
and it looks easy enough, but I am unsure of the values to use for
https://mbientlab.com/androiddocs/latest/i2c.html
And the i2c interface info for my sensor here (page 9):
http://www.robotshop.com/media/files/pdf/MS5837-30BA.pdf
and it looks easy enough, but I am unsure of the values to use for
i2cModule.readData((byte) 0x1c, (byte) 0xd, (byte) 1).onComplete(new CompletionHandler<byte[]>()
Thanks in advance for any advice and help you can provide.
This discussion has been closed.
Comments
i2cModule.readData((byte) 0x76, (byte) 0x0, (byte) 1).onComplete(new CompletionHandler<byte[]>()
I've also found some C and .java examples for that sensor, but based on different APIs. They write to 0xE1 to do an initial Reset (as per DS) and then read 2btyes from the Prom 0xA2, as per DS. The 7 bit device address ix 0x76, but I don't need that for metaware.
How can I use i2cModule.writeData to write just one value?
deviceAddr
, and 0x0 forregisterAddr
." is
that the MetaWear API Read performs a register read and not a raw read.
Basically, the register read operation first writes an address to read from, and then it reads."
My sensors are i2c only (no SPI support) but I may look into http://community.mbientlab.com/discussion/comment/3350/#Comment_3350 or a different sensor.
At the end of the day, though, it would be good if you could add support in the API for "raw" read/write, something like this: That said, I tried everything I could, but if there's some kind of hack to achieve this from existing code, please let me know.