Tak, ale tylko na chwilę podczas zwarcia do masy i zakładam, że nie będzie innych przycisków. Poprawię z delay() na millis()klew wrote: Wed Feb 19, 2020 9:25 pm Tylko ten kod będzie blokował wykonanie aplikacji. A wstawiając kilka przycisków, to będą się nawzajem blokować
Sonoff mini + DS18B20
-
lukfud
- Posts: 2480
- Joined: Thu Nov 23, 2017 11:33 pm
- Location: Warszawa
- Has thanked: 13 times
- Been thanked: 11 times
https://www.facebook.com/groups/supladiy
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
-
lukfud
- Posts: 2480
- Joined: Thu Nov 23, 2017 11:33 pm
- Location: Warszawa
- Has thanked: 13 times
- Been thanked: 11 times
Poprawiony kod, można powiedzieć czysta nowa biblioteka SuplaDevice kolegi @klew
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 <SuplaDevice.h> // https://github.com/klew/arduino
#include <supla/network/esp_wifi.h>
#include <supla/sensor/DS18B20.h>
#include <supla/control/relay.h>
Supla::Control::Relay *dzwonkowy = nullptr;
Supla::Control::Button button(4, true);
const char* srv_addr = "xxx";
const char* srv_email = "xxx";
const char* device_name = "SONOFF MINI";
const char* wifi_ssid = "xxx";
const char* wifi_password = "xxx";
Supla::ESPWifi wifi(wifi_ssid, wifi_password);
void setup() {
uint8_t mac[6];
WiFi.macAddress(mac);
char GUID[SUPLA_GUID_SIZE] = {mac[0],mac[1],mac[2],mac[3],mac[4],mac[5],mac[0],mac[1],mac[2],mac[3],mac[4],mac[5],mac[0],mac[1],mac[2],mac[3]};
char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {mac[0],mac[2],mac[4],mac[1],mac[3],mac[5],mac[1],mac[3],mac[5],mac[0],mac[2],mac[4],mac[0],mac[2],mac[4],mac[1]};
button.willTrigger(*dzwonkowy, Supla::Control::Button::ON_PRESS, Supla::Control::Relay::TOGGLE);
button.setSwNoiseFilterDelay(100);
dzwonkowy = new Supla::Control::Relay(12);
new Supla::Sensor::DS18B20(2);
SuplaDevice.setName(device_name);
SuplaDevice.begin(GUID,srv_addr,srv_email,AUTHKEY);
}
void loop() {
SuplaDevice.iterate();
}
https://www.facebook.com/groups/supladiy
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
-
pzygmunt
- Posts: 20302
- Joined: Tue Jan 19, 2016 9:26 am
- Location: Paczków
- Been thanked: 59 times
Code: Select all
char GUID[SUPLA_GUID_SIZE] = {mac[0],mac[1],mac[2],mac[3],mac[4],mac[5],mac[0],mac[1],mac[2],mac[3],mac[4],mac[5],mac[0],mac[1],mac[2],mac[3]};
char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {mac[0],mac[2],mac[4],mac[1],mac[3],mac[5],mac[1],mac[3],mac[5],mac[0],mac[2],mac[4],mac[0],mac[2],mac[4],mac[1]};SUPLA.... Nareszcie w domu.
-
lukfud
- Posts: 2480
- Joined: Thu Nov 23, 2017 11:33 pm
- Location: Warszawa
- Has thanked: 13 times
- Been thanked: 11 times
Jasne, poprawiam.pzygmunt wrote: Thu Feb 20, 2020 7:30 pmTo przypisanie średnio wygląda to raz, a dwa to użycie mac adresu go wygenerowania GUID-a, i AuthKey to bardzo zły pomysł.Code: Select all
char GUID[SUPLA_GUID_SIZE] = {mac[0],mac[1],mac[2],mac[3],mac[4],mac[5],mac[0],mac[1],mac[2],mac[3],mac[4],mac[5],mac[0],mac[1],mac[2],mac[3]}; char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {mac[0],mac[2],mac[4],mac[1],mac[3],mac[5],mac[1],mac[3],mac[5],mac[0],mac[2],mac[4],mac[0],mac[2],mac[4],mac[1]};
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 <SuplaDevice.h> // https://github.com/klew/arduino
#include <supla/network/esp_wifi.h>
#include <supla/sensor/DS18B20.h>
#include <supla/control/relay.h>
Supla::Control::Relay *dzwonkowy = nullptr;
Supla::Control::Button button(4, true);
const char* srv_addr = "xxx";
const char* srv_email = "xxx";
const char* device_name = "SONOFF MINI";
const char* wifi_ssid = "xxx";
const char* wifi_password = "xxx";
Supla::ESPWifi wifi(wifi_ssid, wifi_password);
void setup() {
// 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};
button.willTrigger(*dzwonkowy, Supla::Control::Button::ON_PRESS, Supla::Control::Relay::TOGGLE);
button.setSwNoiseFilterDelay(100);
dzwonkowy = new Supla::Control::Relay(12);
new Supla::Sensor::DS18B20(2);
SuplaDevice.setName(device_name);
SuplaDevice.begin(GUID,srv_addr,srv_email,AUTHKEY);
}
void loop() {
SuplaDevice.iterate();
}https://www.facebook.com/groups/supladiy
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
-
Robik
- Posts: 28
- Joined: Mon Feb 17, 2020 8:41 pm
Tak jak pisałem na starcie dopiero przygodę zaczynam tak więc w tym sofcie mamy dzwonkowy opcji wyboru na bistabila brak, DS-a, i filtr dobrze to odczytuję?
-
lukfud
- Posts: 2480
- Joined: Thu Nov 23, 2017 11:33 pm
- Location: Warszawa
- Has thanked: 13 times
- Been thanked: 11 times
Tak.Robik wrote: Thu Feb 20, 2020 8:16 pm Tak jak pisałem na starcie dopiero przygodę zaczynam tak więc w tym sofcie mamy dzwonkowy opcji wyboru na bistabila brak, DS-a, i filtr dobrze to odczytuję?
https://www.facebook.com/groups/supladiy
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
-
Robik
- Posts: 28
- Joined: Mon Feb 17, 2020 8:41 pm
No to zbliżamy się do finału jest dobrze do pełni szczęścia tylko wybór bistabila i możemy iść na piwo

-
Robik
- Posts: 28
- Joined: Mon Feb 17, 2020 8:41 pm
lukfud dzięki za naprowadzenie, czytałem o arduino IDE i chyba to na spoko ogarnę muszę ściągnąć i dodać ESP i poleci przez progamator, później zgrać to co przekompiluje i załaduje mi IDE i będzie gotowa binarka, zagra tak jak piszę ?
-
lukfud
- Posts: 2480
- Joined: Thu Nov 23, 2017 11:33 pm
- Location: Warszawa
- Has thanked: 13 times
- Been thanked: 11 times
IDE bezpośrednio załaduje program na ESP.Robik wrote: Thu Feb 20, 2020 8:36 pm lukfud dzięki za naprowadzenie, czytałem o arduino IDE i chyba to na spoko ogarnę muszę ściągnąć i dodać ESP i poleci przez progamator, później zgrać to co przekompiluje i załaduje mi IDE i będzie gotowa binarka, zagra tak jak piszę ?
https://www.facebook.com/groups/supladiy
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
-
Robik
- Posts: 28
- Joined: Mon Feb 17, 2020 8:41 pm
tak, a jak go zgram po załadowaniu będzie binarka na kolejnego mini, na mieszkanie muszę mieć 7 szt., czy wszystkie 7 muszę przez IDE ładować ?
