7 years, 8 months ago.  This question has been closed. Reason: Off Topic

I2C pins 9,10 and pins 27,28

I'm successfully reading the temperature from the TMP102 device but only if I use pin references 28 and 29 in the program below although my device is actually connected via pins 9 and 10? Is there a simple explanation? If I change the program to pins 9 and 10 I get no readings? <</

  1. include "mbed.h"
  2. include "TextLCD.h"
  3. include "TMP102.h"

I2C i2c(p28, p27); sda, scl TextLCD lcd(p15, p16, p17, p18, p19, p20); rs, e, d4-d7

TMP102 TMP102(p28,p27,0x90); Define SDA, SCL pin and i2c address

float TempReading() { float value; value = TMP102.read(); return value; }

int main() { lcd.printf("I2CU! Searching for I2C devices...\n");

int count = 0; for (int address=0; address<256; address+=2) { if (!i2c.write(address, NULL, 0)) { 0 returned is ok lcd.printf(" - I2C device found at address 0x%02X\n", address); count++; wait(5); lcd.cls(); } } lcd.printf("%d devices found\n", count); while (1){ float temperature = TempReading(); lcd.printf("Temperature: %2.f degC\n", temperature); } }