Reading from I2C question.
Hi All,
I am new in here and I received yesterday my metawear board. I have been reading the documentation to program in Android but I have a few questions. I want to connect an ADC through I2C communication which sends after the conversion 16bits of information. I have looked at how to handle the I2C communication and this the example I found I would like to modify:
Is this the right way?
Also I have another question regarding I2C communication. In the ADC it requires before start sending data a bit of Start. What is confusing me is that I can't find any way in the I2C library to send this bit of start. Can anyone clarify me this doubt?
Thanks anyway.
I am new in here and I received yesterday my metawear board. I have been reading the documentation to program in Android but I have a few questions. I want to connect an ADC through I2C communication which sends after the conversion 16bits of information. I have looked at how to handle the I2C communication and this the example I found I would like to modify:
import com.mbientlab.metawear.module.I2C;
I2C i2cModule= mwBoard.getModule(I2C.class);
i2cModule.readData(Device Address, Reg Address, 16).onComplete(new CompletionHandler<byte[]>() {
@Override
public void success(byte[] result) {
Log.i("MainActivity", String.format("WHO_AM_I= %d", result[0]));
}
});
I have a few questions from it. Instead of displaying a Log window what I would like to do is save the 16 bits of conversion into a variable which I would I will to use it later on my program? Just instead a log put perhaps something like this: public string var = result[15] + result[14] + ... + result[0];
Is this the right way?
Also I have another question regarding I2C communication. In the ADC it requires before start sending data a bit of Start. What is confusing me is that I can't find any way in the I2C library to send this bit of start. Can anyone clarify me this doubt?
Thanks anyway.
This discussion has been closed.
Comments