Hi everyone,
I am currently struggeling with getting my newly purchesd ENV 3 Hat and StickC Plus 2 to work.
Current Error: "ENV Hat 3 and StickC Plus 2 [Wire.513] requestFrom(): i2cRead returned Error 263"
My code looks like this:
It is a combination of these two example (Example1, Example2)
#include "M5StickCPlus2.h"
#include "M5UnitENV.h"
SHT3X sht3x;
QMP6988 qmp;
void draw_function(LovyanGFX* gfx) {
    int x      = rand() % gfx->width();
    int y      = rand() % gfx->height();
    int r      = (gfx->width() >> 4) + 2;
    uint16_t c = rand();
    gfx->fillRect(x - r, y - r, r * 2, r * 2, c);
}
void setup() {
    auto cfg = M5.config();
    StickCP2.begin(cfg);
    int textsize = StickCP2.Display.height() / 60;
    if (textsize == 0) {
        textsize = 1;
    }
    StickCP2.Display.setTextSize(textsize);
    
    if (!qmp.begin(&Wire, QMP6988_SLAVE_ADDRESS_L, 0, 26, 400000U)) {
        Serial.println("Couldn't find QMP6988");
        while (1) delay(1);
    }
    if (!sht3x.begin(&Wire, SHT3X_I2C_ADDR, 0, 26, 400000U)) {
        Serial.println("Couldn't find SHT3X");
        while (1) delay(1);
    }
}
void loop() {
    int x      = rand() % StickCP2.Display.width();
    int y      = rand() % StickCP2.Display.height();
    int r      = (StickCP2.Display.width() >> 4) + 2;
    uint16_t c = rand();
    StickCP2.Display.fillCircle(x, y, r, c);
    draw_function(&StickCP2.Display);
      if (sht3x.update()) {
        Serial.println("-----SHT3X-----");
        Serial.print("Temperature: ");
        Serial.print(sht3x.cTemp);
        Serial.println(" degrees C");
        Serial.print("Humidity: ");
        Serial.print(sht3x.humidity);
        Serial.println("% rH");
        Serial.println("-------------\r\n");
    }
    if (qmp.update()) {
        Serial.println("-----QMP6988-----");
        Serial.print(F("Temperature: "));
        Serial.print(qmp.cTemp);
        Serial.println(" *C");
        Serial.print(F("Pressure: "));
        Serial.print(qmp.pressure);
        Serial.println(" Pa");
        Serial.print(F("Approx altitude: "));
        Serial.print(qmp.altitude);
        Serial.println(" m");
        Serial.println("-------------\r\n");
    }
    delay(1000);
}
Produces the following output:
*[377696][E][Wire.cpp:513] requestFrom(): i2cRead returned Error 263
[377724][E][Wire.cpp:513] requestFrom(): i2cRead returned Error 263
-----QMP6988-----
Temperature: 0.00 C
Pressure: 0.00 Pa
Approx altitude: inf m
-------------
I am happy for any help to get these two to work :)
Greetings  Pascal