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)
A może wklej kod , czy mamy wróżyć z fusów
W elektronice jak nie wiadomo o co chodzi to zwykle chodzi o zasilanie
Wezmę udział w Supla Offline Party 2024
Wezmę udział w Supla Offline Party 2024
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:
Kod: Zaznacz cały
#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;
}
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
Może to Ci pomoże:
viewtopic.php?f=23&t=3559
viewtopic.php?f=23&t=3559