Chat wyłapał
Poniżej porada
Przyczyna crasha nie jest w LCD, tylko w wskaźniku `scd4x`.
Masz globalnie:
Code: Select all
Supla::Sensor::SCD4x *scd4x = nullptr;
Code: Select all
auto scd4x = new Supla::Sensor::SCD4x();
Code: Select all
lcd.print(scd4x->getChannel()->getValueDouble(), DEC);
Poprawka
1. W `setup()` przypisz do globalnej (bez `auto`):
Code: Select all
scd4x = new Supla::Sensor::SCD4x();
Minimalnie poprawione fragmenty
Code: Select all
void setup() {
...
scd4x = new Supla::Sensor::SCD4x(); // <-- WAŻNE: bez auto
...
}
void loop() {
SuplaDevice.iterate();
if (millis() - lastRead > 5000) {
lastRead = millis();
```
if (scd4x && scd4x->getChannel()) {
lcd.clear();
lcd.setCursor(0, 1);
lcd.print(scd4x->getChannel()->getValueDouble(), 2);
}
```
}
}
