Will arduino keep digital out high if it crashes?

Will arduino keep digital out high if it crashes?

Thanks

What crashes? Software not doing what you expected? If something happens and it gets reset, the pins default to inputs, if they had external pullups they could be seen as high until the sketch started running and set them as inputs or outputs driven to whatever level the sketch commanded.

I meant arduino freezes or lock ups for some reason. Mine gets in such condition after running a day or two constantly.

Mine gets in such condition after running a day or two constantly.

Well perhaps try to solve that problem first.

Programs do not freeze/crash for no reason and it's always best to find out why.

Perhaps that should be another thread though.

I know various people who have had things running on an arduino for over a year with no issues whatsoever. The most common cause for a crash is running out of RAM or not accounting for variable overflows.

Mowcius

[edit]I meant arduino freezes or lock ups for some reason. [/edit] In general, a microcontroller does not "freeze or lock up", in (exactly) the same sense that your sketch can never "exit."

Except for relatively unlike hardware problems, the arduino CPU will always be running SOME code somewhere in its memory space. A "frozen" sketch means that the code that is executing is not the code you want to be executing, but whether or not the IO pin states are affected will depend on what code IS executing (and what code executed on the way to getting there.)

For example, one way to freeze is to manage to jump to a flash memory location that actually contains text strings. The AVR will happily try to execute those text strings as if they were instructions, and if the particular bytes involved happen to make a loop, your AVR will appear dead. In this case, it PROBABLY didn't change the IO pins before it started looping through the text...

(exercise for the advanced student: What does "Hello World!\n" do if executed as AVR instructions ?)

(exercise for the advanced student: What does "Hello World!\n" do if executed as AVR instructions ?)

I know, I know, it prints out a message saying to please go buy a copy of the K&R C bible, now.

Right? ;)

Lefty