Kod: Zaznacz cały
#include <SuplaDevice.h>
#include <supla/sensor/DS18B20.h>
#include <supla/network/esp_wifi.h>
#include <supla/control/roller_shutter.h>
#include <supla/control/relay.h>
#include <supla/control/button.h>
#include <supla/control/action_trigger.h>
#include <supla/device/status_led.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/status_led_parameters.h>
#include <supla/network/html/wifi_parameters.h>
#include <supla/network/html/security_certificate.h>
#include <supla/device/supla_ca_cert.h>
#include <supla/events.h>
Supla::ESPWifi wifi("TP-LINK_MARCIN", "**********");
void setup()
{
Serial.begin(115200);
uint8_t mac[6];
WiFi.macAddress(mac);
// Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
char GUID[SUPLA_GUID_SIZE] = {0xC6,0xEF,0x6F,0xC7,0x29,0x18,0xAE,0x0B,0x3B,0xC5,0xDB,0x9A,0x1D,0xB0,0xA3,0x3E};
// Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {0xFC,0xC5,0x35,0xA6,0xAB,0x5F,0xAD,0x64,0x0E,0xF6,0x69,0x56,0x90,0x38,0xB3,0xF2};
//DeviceAddress ds1addr = {0x28, 0xFF, 0x4B, 0xFC, 0xA2, 0x17, 0x04, 0xE8}; // Adres czujnika DS18B20 :)
//new Supla::Sensor::DS18B20(2, ds1addr);
auto r1 = new Supla::Control::Relay(13);
auto r2 = new Supla::Control::Relay(12);
auto button1 = new Supla::Control::Button(6, true, true);
auto button2 = new Supla::Control::Button(8, true, true);
button1->addAction(Supla::TOGGLE, *r1, Supla::ON_PRESS);
button2->addAction(Supla::TOGGLE, *r2, Supla::ON_PRESS);
auto at1 = new Supla::Control::ActionTrigger();
at1->setRelatedChannel(r1);
at1->setRelatedChannel(r2);
SuplaDevice.begin(GUID, "svr71.supla.org", "marcingugula9436@gmail.com", AUTHKEY);
}
void loop()
{
SuplaDevice.iterate();
}