Pretty lost on reading data from a temperature sensor (Texas Instruments TMP75) through an I2C. Could really use some help. |=(
I'm 99.9% sure this is the datasheet<http://www.ti.com/lit/ds/sbos288j/sbos288j.pdf>I should be using for the sensor chip. Only not 100% because I searched online for it as the chip was removed from an apple device. The sensor is connected to the SDA & SCL 2 pins located @ pin #s: 25 & 26. Therefore my TWI interface is opened as such: twi = ioio_.openTwiMaster(2, TwiMaster.Rate.RATE_100KHz, false); It is also connected to a 5v pin and a ground pin. Testing with a multimeter, I've seen that all the address pins (A2, A1, A0) are all grounded. Therefore, according to the datasheet, I should be addressing the slave as such: address = 1001011; if(twi.writeRead(address, false, request, request.length, response, response.length)) /*...Write Success...*/ else /*...Write Fail...*/ However, something must be wrong because every time I run the activity(with slight variations) I'm receiving a Fail, the code is skipped over entirely, stops right then & there at the write/read line, or (as it is doing right now) breaking the connection with the IOIO board and restarting the entire Looper class repeatedly. Any advice, guidance, or help whatsoever would be greatly greatly appreciated. Much thanks. (=]] All my best, Brad E p.s. total code in case relevant: package ioio.examples.hello; public class Temperature extends IOIOActivity { private static TextView tempReadOutView; byte[] request; byte[] response; int address; TwiMaster twi; int runs = 0; int duration; Context context; String decoded = ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.templayout); } class Looper extends BaseIOIOLooper { @Override protected void setup() throws ConnectionLostException, InterruptedException { displayTemp("IOIO Connected"); twi = ioio_.openTwiMaster(2, TwiMaster.Rate.RATE_100KHz, false); request = new byte[] {0x01, 0x02}; response = new byte[1]; address = 1001011; //or 1001000 displayTemp("Set up Done"); if(twi.writeRead(address, false, request, request.length, response, response.length)) displayTemp("True"); else displayTemp("False"); } public void loop() throws ConnectionLostException, InterruptedException { } } @Override protected IOIOLooper createIOIOLooper() { return new Looper(); } public void displayTemp(final String str) throws InterruptedException { Thread.sleep(1200); runOnUiThread(new Runnable() { @Override public void run() { context = getApplicationContext(); duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, str, duration); toast.show(); } }); } } -- 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.
