
Sketch examples
#include
<U8g2lib.h>
#include
<
Wire
.h>
#include
<Adafruit_Sensor.h>
#include
<Adafruit_BME280.h>
Adafruit_BME280 bme;
#define
TCAADDR 0x70
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C
u8g2
(U8G2_R0, U8X8_PIN_NONE);
void
TCA9548A(
uint8_t
bus) {
Wire
.
beginTransmission
(0x70);
Wire
.
write
(1 << bus);
Wire
.
endTransmission
();
}
void
u8g2_prepare() {
u8g2
.
setFont
(
u8g2_font_6x10_tf
);
u8g2
.
setFontRefHeightExtendedText
();
u8g2
.
setDrawColor
(1);
u8g2
.
setFontPosTop
();
u8g2
.
setFontDirection
(0);
}
void
setup
() {
Wire
.
begin
();
Serial
.
begin
(9600);
TCA9548A(0);
bool
communication = bme.
begin
(0x76);
TCA9548A(1);
u8g2
.
begin
();
u8g2_prepare();
- 16 -