Dobryxzihen wrote: Sun May 24, 2020 9:08 pm sprawdziłem tą opcję:Niestety w bilblio SuplaDevice nie ma addRelayButton i dostaje błąd kompilacji...Code: Select all
//---------------------------------------------------------- // podanie "0" na 12 (D6) wlacza 13 (D7), "1" gasi 13 SuplaDevice.addRelayButton(13, 12, INPUT_TYPE_BTN_BISTABLE); //--------

Nie brnij w starą bibliotekę, skorzystaj z nowej, którą zaproponował Ci @klew.
Poniżej przykład z tym co chcesz mieć (gpio pewnie do zmiany)klew wrote: Thu May 21, 2020 10:15 pm Spróbuj może na nowej wersji biblioteki ( https://github.com/klew/arduino )
Tam jest przykład z dwoma DHT22 - wystarczy kilka drobnych zmian aby uruchomić jeden DHT11
https://github.com/klew/arduino/blob/ma ... la_DHT.ino
Code: Select all
#include <SPI.h>
#include <SuplaDevice.h>
#include <supla/sensor/DHT.h>
#include <supla/control/relay.h>
#include <supla/control/button.h>
#include <supla/sensor/binary.h>
#include <supla/network/esp_wifi.h>
Supla::ESPWifi wifi("your_wifi_ssid", "your_wifi_password");
/*
* This example requires DHT sensor library installed.
* https://github.com/adafruit/DHT-sensor-library
*/
#define DHTPIN 2
#define DHTTYPE DHT11
Supla::Control::Relay przekaznik_1(12, false);
Supla::Control::Button bistabilny_1(4, true);
Supla::Control::Relay przekaznik_2(13, false);
Supla::Control::Button bistabilny_2(5, true);
void setup() {
Serial.begin(115200);
// Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
char GUID[SUPLA_GUID_SIZE] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
// Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
new Supla::Sensor::DHT(DHTPIN, DHTTYPE);
bistabilny_1.willTrigger(przekaznik_1, Supla::ON_CHANGE, Supla::TOGGLE);
bistabilny_2.willTrigger(przekaznik_2, Supla::ON_CHANGE, Supla::TOGGLE);
new Supla::Sensor::Binary(16, true);
SuplaDevice.begin(GUID, // Global Unique Identifier
"svr1.supla.org", // SUPLA server address
"email@address", // Email address used to login to Supla Cloud
AUTHKEY); // Authorization key
}
void loop() {
SuplaDevice.iterate();
}
viewtopic.php?f=61&t=6163
viewtopic.php?f=61&t=5754
viewtopic.php?f=61&t=5486
Tu jest fajny przykład z powiadomieniem:
viewtopic.php?p=67919#p67919