Hej.
Prosze o pomoc z biblioteka dla Arduino.
Plytka to Wemod D1.
W IDE wybrana plytka Wemos D1 R1.
Po dodaniu (aktywowaniu) przekaznika w kodzie dla Arduinio, modul sie resetuje po wyslaniu komendy czy to wlaczenia czy wylaczenia.
Bibiolteki ESP (2.2, 2.3 i najnowsza) ten sam problem.
Kod bledu:
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v8b899c12
Reset Wemosa po dodaniu przekaznika (Watchdog)
-
LWww
- Posts: 10
- Joined: Sun Mar 17, 2019 4:49 pm
Jak pisalem, standardowy kod bez fajerwerkow.
Bez SuplaDevice.addRelay(D2) otrzymuje w monitrorze "Registered and ready." , z odkomentowanym przekaznikiem wdt reset".
Kod:
Bez SuplaDevice.addRelay(D2) otrzymuje w monitrorze "Registered and ready." , z odkomentowanym przekaznikiem wdt reset".
Kod:
Code: Select all
#include <ESP8266WiFi.h>
#define SUPLADEVICE_CPP
#include <SuplaDevice.h>
WiFiClient client;
// Setup Supla connection
const char* ssid = "wifi";
const char* password = "haslo";
void setup() {
Serial.begin(115200);
// Replace the falowing GUID
char GUID[SUPLA_GUID_SIZE] = {****};
// with GUID that you can retrieve from https://www.supla.org/arduino/get-guid
// Ethernet MAC address
uint8_t mac[6] = {0x00, 0x02, 0x01, 0x03, 0x04, 0x05};
/*
* Having your device already registered at cloud.supla.org,
* you want to change CHANNEL sequence or remove any of them,
* then you must also remove the device itself from cloud.supla.org.
* Otherwise you will get "Channel conflict!" error.
*/
// CHANNEL0 - RELAY
//SuplaDevice.addRelay(D2);
SuplaDevice.begin(GUID, // Global Unique Identifier
mac, // Ethernet MAC address
"serv.supla.org", // SUPLA server address
id, // Location ID
"pass"); // Location Password
}
void loop() {
SuplaDevice.iterate();
}
// Supla.org ethernet layer
int supla_arduino_tcp_read(void *buf, int count) {
_supla_int_t size = client.available();
if ( size > 0 ) {
if ( size > count ) size = count;
return client.read((uint8_t *)buf, size);
};
return -1;
};
int supla_arduino_tcp_write(void *buf, int count) {
return client.write((const uint8_t *)buf, count);
};
bool supla_arduino_svr_connect(const char *server, int port) {
return client.connect(server, 2015);
}
bool supla_arduino_svr_connected(void) {
return client.connected();
}
void supla_arduino_svr_disconnect(void) {
client.stop();
}
void supla_arduino_eth_setup(uint8_t mac[6], IPAddress *ip) {
// Serial.println("WiFi init");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
// Serial.print(".");
}
//Serial.print("\nlocalIP: ");
//Serial.println(WiFi.localIP());
//Serial.print("subnetMask: ");
//Serial.println(WiFi.subnetMask());
//Serial.print("gatewayIP: ");
//Serial.println(WiFi.gatewayIP());
}
SuplaDeviceCallbacks supla_arduino_get_callbacks(void) {
SuplaDeviceCallbacks cb;
cb.tcp_read = &supla_arduino_tcp_read;
cb.tcp_write = &supla_arduino_tcp_write;
cb.eth_setup = &supla_arduino_eth_setup;
cb.svr_connected = &supla_arduino_svr_connected;
cb.svr_connect = &supla_arduino_svr_connect;
cb.svr_disconnect = &supla_arduino_svr_disconnect;
cb.get_temperature = NULL;
cb.get_temperature_and_humidity = NULL;
cb.get_rgbw_value = NULL;
cb.set_rgbw_value = NULL;
return cb;
}
-
Zybi
- Posts: 1511
- Joined: Sun Jun 26, 2016 4:24 pm
Metoda SuplaDevice.addRelay(D2) nie rozumie co to jest D2, stosuj "czystą" numerację GPIO.
-
LWww
- Posts: 10
- Joined: Sun Mar 17, 2019 4:49 pm
Probowalem chyba wszystkich opcji: D2, 04, 4
Plytki Wemos D1 R1, Lolin Wemos D1 R1, Generic, Sparkfun
Zawsze konczy sie to loopem wywolanym przez watchdoga.
Jak tylko usune obsluge przekaznika, dziala; modul poprawnie obsluguje czujniki.
Plytki Wemos D1 R1, Lolin Wemos D1 R1, Generic, Sparkfun
Zawsze konczy sie to loopem wywolanym przez watchdoga.
Jak tylko usune obsluge przekaznika, dziala; modul poprawnie obsluguje czujniki.
-
cino111
- Posts: 714
- Joined: Mon May 07, 2018 8:00 pm
Sprawdzasz na podłączonym przekaźniku? Może coś z przekaźnikiem?
-
piomar2
- Posts: 369
- Joined: Fri Apr 26, 2019 5:32 pm
- Location: Bukowice
Zamiast //SuplaDevice.addRelay(D2);
wpisz: SuplaDevice.addRelay(4, false);
lub : SuplaDevice.addRelay(4, true);
w zależności czy na wyj D2(4) ma być "1" czy "0"
Kod działa bez zarzutu. Loguje się w supli i nic się nie resetuje.
Kompilowane w arduino 1.8.3
wpisz: SuplaDevice.addRelay(4, false);
lub : SuplaDevice.addRelay(4, true);
w zależności czy na wyj D2(4) ma być "1" czy "0"
Kod działa bez zarzutu. Loguje się w supli i nic się nie resetuje.
Kompilowane w arduino 1.8.3
-
Patryk
- Posts: 2944
- Joined: Mon Jan 07, 2019 7:51 pm
- Location: Rybnik
-
LWww
- Posts: 10
- Joined: Sun Mar 17, 2019 4:49 pm
Udalo sie, dziala, problem byl w wersji "plytek" dla Arduino; ESP8266. Tylko wersja 2.4.1 (nic ponizej, nic powyzej) umozliwia poprawna (dzialajaca) kompilacje.
Dzieki za pomoc.
Pozdr
Dzieki za pomoc.
Pozdr
-
piomar2
- Posts: 369
- Joined: Fri Apr 26, 2019 5:32 pm
- Location: Bukowice
A to ciekawe
A która wersja arduino? U mnie wersja płytek 2.4.2 i kompilowane w arduino 1.8.3
