user63103: I am using 2 grove components in order to display a temperature. I use an I2C High Accuracy Temperature Sensor - MCP9808 and an OLED Screen using this script:
#include <U8g2lib.h>
#include <SPI.h>
#include <Wire.h>
#include "Seeed_MCP9808.h"

MCP9808 sensor;
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/SCL, /* data=*/SDA, /* reset=*/U8X8_PIN_NONE);  //Software I2C

char strTemp\[16\];
float temp;

void setup() {
  u8g2.begin();
  Serial.begin(115200);
  
  if (sensor.init()) {
    Serial.println("sensor init failed!!");
  }   
  sensor.set_config(SET_CONFIG_ADDR, 0x0008);
  Serial.println("sensor init!!");
}

void loop() {
  sensor.get_temp(&temp);
  Serial.print("temperature value is: ");
  Serial.println(temp);
  delay(1000);

  dtostrf(temp, 7, 2, strTemp);

  u8g2.clearBuffer();                   // clear the internal memory
  u8g2.setFont(u8g2_font_luBIS08_tf);   // choose a suitable font
  u8g2.drawStr(0, 10, "Hello Seeed!");  // write something to the internal memory
  u8g2.drawStr(0, 30, "Temp. value:");  // write something to the internal memory
  u8g2.drawStr(0, 50, strTemp);         // write something to the internal memory
  u8g2.sendBuffer();                    // transfer internal memory to the display
}

The temperature output is not updated on the screen and I think it might be related to I2C addresses. Is it possible?
I run an I2C scanner and I think that the OLED address is 0x3C and the temp. sensor is 0x18. How can I assign them correctly. I never done something like that so any help is welcome.
Thanks a lot.

user37622: You mix software I2C with hardware I2C on the hardware I2C pins.
To use hw I2C with the display use the U8G2_SSD1306_128X64_NONAME_F_HW_I2C constructor.
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/U8X8_PIN_NONE);  

Or use a different pair of pins for the software I2C display control.

63103: <p>I am using 2 grove components in order to display a temperature. I use an <a href="https://www.seeedstudio.com/Grove-I2C-High-Accuracy-Temperature-Sensor-MCP9808.html" rel="nofollow noreferrer">I2C High Accuracy Temperature Sensor - MCP9808</a> and an <a href="https://www.seeedstudio.com/Grove-OLED-Yellow-Blue-Display-0-96-SSD1315-V1-0-p-5010.html" rel="nofollow noreferrer">OLED Screen</a> using this script:</p>
<pre><code>#include &lt;U8g2lib.h&gt;
#include &lt;SPI.h&gt;
#include &lt;Wire.h&gt;
#include &quot;Seeed_MCP9808.h&quot;

MCP9808 sensor;
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/SCL, /* data=*/SDA, /* reset=*/U8X8_PIN_NONE);  //Software I2C

char strTemp\[16\];
float temp;

void setup() {
  u8g2.begin();
  Serial.begin(115200);
  
  if (sensor.init()) {
    Serial.println(&quot;sensor init failed!!&quot;);
  }   
  sensor.set_config(SET_CONFIG_ADDR, 0x0008);
  Serial.println(&quot;sensor init!!&quot;);
}

void loop() {
  sensor.get_temp(&amp;temp);
  Serial.print(&quot;temperature value is: &quot;);
  Serial.println(temp);
  delay(1000);

  dtostrf(temp, 7, 2, strTemp);

  u8g2.clearBuffer();                   // clear the internal memory
  u8g2.setFont(u8g2_font_luBIS08_tf);   // choose a suitable font
  u8g2.drawStr(0, 10, &quot;Hello Seeed!&quot;);  // write something to the internal memory
  u8g2.drawStr(0, 30, &quot;Temp. value:&quot;);  // write something to the internal memory
  u8g2.drawStr(0, 50, strTemp);         // write something to the internal memory
  u8g2.sendBuffer();                    // transfer internal memory to the display
}
</code></pre>
<p>The temperature output is not updated on the screen and I think it might be related to I2C addresses. Is it possible?</p>
<p>I run an I2C scanner and I think that the OLED address is 0x3C and the temp. sensor is 0x18. How can I assign them correctly. I never done something like that so any help is welcome.</p>
<p>Thanks a lot.</p>
 37622: <p>You mix software I2C with hardware I2C on the hardware I2C pins.</p>
<p>To use hw I2C with the display use the U8G2_SSD1306_128X64_NONAME_F_<strong>HW</strong>_I2C constructor.</p>
<pre><code>U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/U8X8_PIN_NONE);  
</code></pre>
<p>Or use a different pair of pins for the software I2C display control.</p>
