MKR1000 disconnects from wifi when I add the Scheduler code

Hello,
I am using Arduino IoT with MKR1000. Everything is running fine, and I can control arduino outputs over wifi, until I add the scheduler.
Upon adding the scheduler, everything compiles and I am able to upload the sketch, but then the MKR1000 stops connecting to wifi, so I am unable to control it. Once I remove the scheduler, the MKR1000 starts connecting to wifi. Need help on this.

Here is the code:

#include "thingProperties.h"

void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);

// Defined in thingProperties.h
initProperties();

// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);

setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();

pinMode(LED_BUILTIN, OUTPUT);
light_scheduler = false;
}

void loop() {
ArduinoCloud.update();
if(scheduler.isActive()){
digitalWrite(LED_BUILTIN, HIGH);
}
else{
digitalWrite(LED_BUILTIN, LOW);
}
}

void onSchedulerChange() {
}

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