fadamako wrote: Tue Sep 01, 2020 2:53 am
Ślicznie dziękuję za informację.
Nie mogę się już doczekać
Maniek913 wrote: Tue Sep 01, 2020 6:03 am
Ja też
UWAGA: wersja BETA
Dodałem do biblioteki wspracie dla rolet oraz zapisywania do pamięci FRAM, EEPROM (flash dla ESP) (na razie dostępne tutaj:
https://github.com/klew/arduino - do oficjalnego repo będzie dodane później).
Chętnych zapraszam do testowania. W kwesti zapisywania różnych danych do pamięci, będzie jeszcze dużo zmian i dodatków. Na chwilę obecną zapisują się tam tylko dane o roletach (czasy otwierania, zamykania i aktualna pozycja).
EEPROM/flash testowany na Arduino Mega i na ESP8266 (Wemos).
FRAM SPI (od Adafruit) testowany na razie tylko na Arduino Mega (na hardware SPI oraz na software SPI).
Przykładowy program:
Code: Select all
/*
Copyright (C) AC SOFTWARE SP. Z O.O.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <SPI.h>
#include <SuplaDevice.h>
#include <supla/control/roller_shutter.h>
#include <supla/control/button.h>
#include <supla/storage/fram_spi.h>
// #include <supla/storage/eeprom.h>
#define SUPLA_STORAGE_OFFSET 0
#define FRAM_CS 43 // pin for FRAM CS
Supla::FramSpi fram(FRAM_CS, SUPLA_STORAGE_OFFSET);
// Supla::FramSpi fram(24, 22, 23, FRAM_CS, SUPLA_STORAGE_OFFSET); // <- sofrware spi, piny (SCK, MISO, MOSI, CS)
// Supla::Eeprom fram(SUPLA_STORAGE_OFFSET);
// Choose proper network interface for your card:
// Arduino Mega with EthernetShield W5100:
#include <supla/network/ethernet_shield.h>
// Ethernet MAC address
uint8_t mac[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
Supla::EthernetShield ethernet(mac);
//
// ESP8266 based board:
// #include <supla/network/esp_wifi.h>
// Supla::ESPWifi wifi("your_wifi_ssid", "your_wifi_password");
//
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};
Supla::Control::RollerShutter *rs = new Supla::Control::RollerShutter(30, 31, false);
Supla::Control::Button *buttonOpen = new Supla::Control::Button(28, true, true);
Supla::Control::Button *buttonClose = new Supla::Control::Button(29, true, true);
buttonOpen->willTrigger(*rs, Supla::ON_PRESS, Supla::OPEN_OR_STOP);
buttonClose->willTrigger(*rs, Supla::ON_PRESS, Supla::CLOSE_OR_STOP);
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();
}
W klasach "storage" można podać "offset" - jeśli coś już przechowujecie w pamięci i chcecie, aby SuplaDevice przesunąła się dalej, to ustawcie to na odpowiednią wartość.
SuplaDevice używa aktualnie 15 bajtów + ilość rolet razy 9 bajtów.
You do not have the required permissions to view the files attached to this post.