Header file delaying the setup function

Hello there,

I have a sketch where I am using the setup function to turn on an LED, amongst other things. The program also has some header files included.

When I run the code it takes approximately 10s to reach the setup() as the LED gets turned on after that and also the Serial.print commands get called in after 10 seconds.

If I remove a particular header file the LED lights up instantaneously and I can also see the text that I print in the setup function instantaneously.

The header file is of OTA (over the air). I am using the redbear ble module which has an nrf chip.

I was wondering if there is a way to get the setup function run without this delay. If not, if there is a way to at least turn on the LED before even the header files initialize. TIA.

You need to share your code with us. Also, think critically about what OTA is and how it works and why it works. Think how executing code while checking for updates might cause more harm than good.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html .
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

Global variables are initialized before setup() runs. If any global variable is an object that takes a long time in its constructor function, setup() will be delayed.