Help with Arduino OTA Code on ESP8266

Greetings everyone

I have a sketch named "MatrixClock.ino" and I would like to add the OTA functions to it, taking advantage of another sketch "ESP8266_Led_Blink.ino" that has OTA but, I don't have enough knowledge; in fact, I tried to do it but it didn't work, so I would like to ask someone here to do it for me.

Remembering that the two attached sketches are working.

My advance thanks

ESP8266_Led_Blink.ino (2.33 KB)

MatrixClock.ino (30.5 KB)

Someone to help?

I would have thought that after 200 forum posts would have known to post more information about symptoms. Just saying "it didn't work" is rarely helpful.

Anyway, try moving ArduinoOTA.handle(); inside the infinite loop at line 740; I think you'll get a better result.

Hi arduarn, first, thanks for the reply. Sorry for not posting correctly;

is that I thought about making a post cleaner, because, in fact, I'm asking someone, out of kindness, to join these two codes for me: ESP8266_Led_Blink + MatrixClock.

The two sketches are working normally, but I was unable to combine the two in order to work. Did you understand?

I had posted here: Help with Arduino OTA Code on ESP8266 - Project Guidance - Arduino Forum

Thanks again

arduarn:
I would have thought that after 200 forum posts would have known to post more information about symptoms. Just saying "it didn't work" is rarely helpful.

Anyway, try moving ArduinoOTA.handle(); inside the infinite loop at line 740; I think you'll get a better result.

Ok but, in the sketch that has the OTA: ESP8266_Led_Blink.ino, the ArduinoOTA.handle (); is right at the beginning of the void loop ().

Dancopy:
I had posted here: Help with Arduino OTA Code on ESP8266 - Project Guidance - Arduino Forum

OK, I see my suggestion was already pointed out to you in the other thread. That's annoying.

I appreciate you opened this additional thread in Gigs&Collaborations under advisement from another poster, but it would actually have been better to ask a moderator to just move your existing thread to the G&C section. You can do that by reporting one of your own posts in the thread to a moderator and asking them to do it for you.
Opening multiple threads per topic/problem just wastes people's time and causes annoyance.

Dancopy:
The two sketches are working normally, but I was unable to combine the two in order to work. Did you understand?

I thought I did until you seem to not have implemented a potential solution in spite of two people suggesting it.

Dancopy:
Ok but, in the sketch that has the OTA: ESP8266_Led_Blink.ino, the ArduinoOTA.handle (); is right at the beginning of the void loop ().

So what? It might work in that sketch, but it doesn't work in this new sketch.
handle() must be called frequently but, because of the infinite loop inside of the loop() function, it will only be called once in the new sketch. Don't be afraid, just try the change and test it out. Worst that can happen is it doesn't work.

Just so it's clear, the code should look like this:

... 
    while (true) {
        ArduinoOTA.handle(); // moved from original location
        yield();
...

@arduarn
Would you mind if I asked you, out of kindness, for you to join the two codes for me?

I have difficulties, because there are many functions, etc., in one code and the other. Thank you

Dancopy:
@arduarn
Would you mind if I asked you, out of kindness, for you to join the two codes for me?

I have difficulties, because there are many functions, etc., in one code and the other. Thank you

really ? 215 posts and 4 karmas ?

Dancopy:
@arduarn
Would you mind if I asked you, out of kindness, for you to join the two codes for me?

I have difficulties, because there are many functions, etc., in one code and the other. Thank you

I don't know if we are getting crossed wires on this or something, but you have already joined the two sketches together with respect to the OTA functionality. All you have to do is make one small change and it will probably work. Out of kindness I suggest that you make that change yourself to get the personal satisfaction if it works. You only have to move one line of code.

If I were to join the sketches I wouldn't be doing much different to what you have done yourself. In my case I wouldn't be able to test it since I don't have an ESP8266 lying around.

@arduarn
Ok, I will try and, at the moment, I just thank you, who tried to help me!

@KASSIMSAMJI
I thank you for the warmth and respect for a 53-year-old "boy"!

@arduarn

It worked, moving the "ArduinoOTA.handle ();" to the start of while (true), as you said.
I just kept thinking this: because it had to be like this, because, all the sketches with the OTA function (including BasicOTA) that I've already seen, this function is at the beginning of the "void loop ()".

Thank you, you helped me!

Got there in the end. You're welcome!