Thats what I needed Ytai, I really appreciate your help on this. I really 
owe you. I will let you know as soon as possible what do I have done.

On Saturday, March 22, 2014 12:10:27 AM UTC, Ytai wrote:
>
> According to the table on page 10 of the datasheet, the address depends on 
> where you're connecting the A0 pin to. You have to connect it to either 
> GND, V+, SDA or SCL, resulting in address 0x48, 0x49, 0x4A, ox4B, 
> respectively.
> Also note that if you're using the SparkFun breakout board for the TMP102, 
> you don't need external pull-ups, as they are included on the breakout 
> board, so your connections needs to be:
> VCC <-> IOIO 3.3V
> GND <-> IOIO GND
> SDA <-> IOIO SDA
> SCL <-> IOIO SCL
> ADD0 <-> either one of the 4 pins mentioned above.
>
> BTW, I dug up some old project I have that uses the IOIO with a TMP102. 
> Here's the code:
>
> public class TMP102 {
>   private static final byte[] TEMP_REQUEST = {0x00};
>
>   private final TwiMaster twi_;
>   private final byte address_;
>   private final byte[] responseBuffer_ = new byte[2];
>
>   public TMP102(TwiMaster twi, byte address) {
>     twi_ = twi;
>     address_ = address;
>   }
>
>   public float getTemperatureKelvin()
>       throws ConnectionLostException, InterruptedException, 
> CommunicationException {
>     if (!twi_.writeRead(address_, false, TEMP_REQUEST, 1, responseBuffer_, 
> 2)) {
>       throw new CommunicationException("I2C transaction with TMP102 
> failed.");
>     }
>     int temp = Unsigned.from(responseBuffer_[0]) << 8 | 
> Unsigned.from(responseBuffer_[1]);
>     temp >>= 4;
>     return temp / 16.f + 273.15f;
>   }
> }
>
> And:
>
> public class Unsigned {
>   public static int from(byte b) {
>     return b & 0xFF;
>   }
>
>   public static int from(short s) {
>     return s & 0xFFFF;
>   }
> }
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to