Testuję właśnie najnowsze SuplaDevice z obsługą SCD41.
Clauda udało się odpalić, ale mam problem z pobraniem danych np. do LCD.
Code: Select all
#include <SuplaDevice.h>
#include <supla/network/esp_wifi.h>
#include <supla/sensor/SCD4x.h>
#include <supla/storage/littlefs_config.h>
#include <supla/network/esp_web_server.h>
#include <supla/network/html/device_info.h>
#include <supla/network/html/protocol_parameters.h>
#include <supla/network/html/wifi_parameters.h>
#include <supla/network/html/i2cscanner.h>
#include <supla/network/html/button_update.h>
#include <supla/device/status_led.h>
#include <supla/control/button.h>
//#include <supla/sensor/DS18B20.h>
#include <LiquidCrystal_I2C.h>
#define DEV_NAME "SCD4x test"
#define BUTTON_CFG_GPIO 0
#define STATUS_LED_GPIO 2
//#define DS18B20_GPIO D3
#define SDA_PIN D2
#define SCL_PIN D1
Supla::ESPWifi wifi;
Supla::LittleFsConfig configSupla;
Supla::Device::StatusLed statusLed(STATUS_LED_GPIO, true); // inverted state
Supla::EspWebServer suplaServer;
Supla::Sensor::SCD4x *scd4x = nullptr;
/* Kanały SUPLA */
double temperature;
int chTemp, chHum, chCO2;
unsigned long lastRead = 0;
auto buttonCfg = new Supla::Control::Button(BUTTON_CFG_GPIO, true, true);
LiquidCrystal_I2C lcd(0x27,16,2);
float myFloat = 13.22769;
void setup() {
Serial.begin(115200);
// WevInterface with Update
new Supla::Html::DeviceInfo(&SuplaDevice);
new Supla::Html::WifiParameters;
new Supla::Html::ProtocolParameters;
// new Supla::Html::StatusLedParameters;
new Supla::Html::ButtonUpdate(&suplaServer);
buttonCfg->configureAsConfigButton(&SuplaDevice);
// I2C start & scan
Wire.begin(SDA_PIN, SCL_PIN);
new Supla::Html::I2Cscanner();
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("Hello, world!");
lcd.setCursor(0,1);
lcd.print(myFloat, DEC);
auto scd4x = new Supla::Sensor::SCD4x();
// new Supla::Sensor::DS18B20(DS18B20_GPIO);
SuplaDevice.setName(DEV_NAME);
SuplaDevice.setInitialMode(Supla::InitialMode::StartInCfgMode);
SuplaDevice.begin();
}
void loop() {
SuplaDevice.iterate();
if (millis() - lastRead > 5000) {
lastRead = millis();
lcd.clear();
lcd.setCursor(3,1);
lcd.print(scd4x->getChannel()->getValueDouble(), DEC);
}
}
Code: Select all
lcd.print(scd4x->getChannel()->getValueDouble(), DEC);Po czym poznać które metody są dostępne ( getChannel()->getValueDoubleFirst())?
Jak zgodnie ze sztuką powinno się w Supli obsługiwać lokalnie LCD?
Przydałby się przykład jak LCD podpina np. GuiGeneric.
