Replies: 2 comments 6 replies
-
do you really want that and why do you wait 2 seconds every loop after |
Beta Was this translation helpful? Give feedback.
4 replies
-
which Ethernet library is it? the Arduino Ethernet library for W5500? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have mega2560 in use with some sensors, relay and light control. I use mqtt PubSubClient for sending data in/out on port 1883 and Wirepusher for notifications on port 80. If i upload OTA sketch into mega, my Wirepusher fail to connect on port 80 to send notification to my phone. When i remove OTA the connection is ok. Mqtt client is working with OTA.
This are some code line from the begining of the sketch:
byte mac[] = {0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA };
IPAddress ip(192, 168, 1, 112); // IP address,
IPAddress server(192, 168, 1, 117); // mqtt server
EthernetServer androidServer(2562); // set port number for android netIO
EthernetClient clientWirepusher; // client for notification
EthernetClient ethClient;
PubSubClient client(ethClient);
I think is a conflict between clients. So i try to start ArduinoOTA only when i need it by sending command on mqtt.
I have a ota state initialized false at arduino startup and when i need to upload OTA i send a true state on mqtt.
So, I have this:
#include <ArduinoOTA.h>
boolean otastart = false;
void runota() {
ArduinoOTA.begin(Ethernet.localIP(), "arduino", "password", InternalStorage);
otastart=true;
}
void loop(){
if (otastart==true){
client.publish("ArduinoSlave/OTA","ready");
ArduinoOTA.poll();
delay(2000);
return;
}
and from mqtt command (payload, "ota") to activate runota();
}
But unfortunately it doesn't work all the time. Sometimes the program freezes when I start the ota function.
Any ideas are welcome.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions