delay() before setup()?

I have an LCD panel that boots up the same time as the Arduino that is connected to it. I want the Arduino to wait until the LCD is all powered up and it's flash screens are done before it runs it's own code.

I know I could test this but not in the position to do so at the moment.

Will delay() work in the code before the void setup() ? I assume it will, but like I said, can't test atm.

Are their better alternatives? I don't like using the delay() function because of how it works. But I think using it before the setup might be OK, and it's not something that will be repeated unless a reboot happens.

Is their a way to tell the Arduino to reboot programicaly?

Will delay() work in the code before the void setup() ? I assume it will, but like I said, can't test atm.

No, it won't. The delay() function is executable code. All executable code must be in a function block.

There is no reason you couldn't put the delay() as the first thing in setup(), so that only the constructors and init() method are executed before you stop doing anything for a while.

Is their a way to tell the Arduino to reboot programicaly?

If you need to, there is something wrong with your code. Fix that problem FIRST.

PaulS:

Is their a way to tell the Arduino to reboot programicaly?

If you need to, there is something wrong with your code. Fix that problem FIRST.

Don't need to no, just was wondering.

The issue is that the Arduino boots up first and starts reading and recording data. It updates the panel only when the data changes. So by the time the LCD is all powered up, it shows all 0's until the data changes and it gets updated. So I need the LCD to power up first so it don't miss the first update from the Arduino. If there was a way to tell the Arduino to reboot, the LCD could send a reboot when it's ready to receive data. I guess I could tell the Arduino to wait for a signal from the panel, but the delay() in the setup should work just as good and it's simple.

Thanks

I guess I could tell the Arduino to wait for a signal from the panel, but the delay() in the setup should work just as good and it's simple.

Depending on the LCD, and the library being used, the LCD may be readable - it may be able to tell you when it is ready.

Will delay() work in the code before the void setup() ? I assume it will, but like I said, can't test atm.

as PaulS states put the delay as first command in your setup().

void setup()
{
  delay(10000UL);
  etc
}

Another option is to patch the Arduino main() function that can be found in main.cpp in your duino distribution

(this is 0.22 version, other versions differ slightly)

#include <WProgram.h>

int main(void)
{
	init();
        delay(10000UL);  // <<<<<<<<<<<<<<<<< add this line
	setup();
    
	for (;;)
		loop();
        
	return 0;
}

problem is that you will get it in every executable... but that is no problem either as you can remove it again ... and again ...