Trouble w/ OTA update: IDE says update success, but code unchanged

Hi, my project seems to be coming along, but I'm having trouble with OTA code update. The web-based IDE says, "Done Uploading," but my code has not changed. I'm trying to do this remotely, so I can't press the reset button.

Any ideas? Thanks, Tom

My components: Arduino MKR WiFi 101, Web IDE, Chrome

Hi @tomgohring.

Please provide a detailed description of what led you to this conclusion.

I ask because an alternative explanation for a report of "my code has not changed" is that the new program was updated, but has a different runtime behavior than you expected, and the observable behavior happens to be the same/similar as the behavior of the previous program.

Hi ptillisch, good question. I have a dummy IOT dashboard variable in my code to check if the update has happened. I put a float variable to represent the date of last update. So for today (May 5, 2024), the value would be 5.052024.

So I know that the update was not successful because the value of that variable was unchanged from the last update.

Cheers, Tom

Thanks for the clarification.

I just gave it a try with my MKR WiFi 1010 running this simple Thing sketch:

/* 
  Arduino IoT Cloud Variables description

  float indicator;
*/

#include "thingProperties.h"

void setup() {
  initProperties();
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  indicator = 5.072024;
}

void loop() {
  ArduinoCloud.update();
}

I changed the value of the indicator variable in the code and then uploaded via OTA, then checked the value of the Variable on the dashboard. The value updated as expected.

Is the problem still occurring for you if you try it again now? If so, please share your sketch code in a reply here and I'll investigate further.

I have resolved my problem by moving my equation into the main loop. This is not as efficient, but it works. Thanks!!!

Is the variable configured as "Read & Write" (this is the default when you create a Variable)? If so, I think I know what happened. When the board connects to Arduino Cloud (which is done by the ArduinoCloud.update() call), all "Read & Write" variables are set to the current value in the dashboard. So if you only set the value of the variable in the sketch code before that point in the program execution, then that is simply replaced with the value from the dashboard and the value set in the sketch code is never sent to the dashboard.

I didn't experience that problem in my test because I selected the appropriate "Read Only" configuration when creating my indicator Variable.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.