Application Crash

Hi Folks,

So I have written a program, its perhaps overly complicated, but, long story short I ran it heavy and within a few minutes, the app appeared to hang. I am unsure if it hang because the Serial port was full of data, or what - so I am running it at a slower pace to monitor it.

I am wondering if I have a buffer overrun condition, but It doesnt appear to have been detected in building the sketch?

I am familiar with vb.net, and I know when the app drops dead, you get a .net error appear, but if the app crashes on the arduino itself, I am not sure if it can be identified. I am new to C++ as well as Arduino, so I am still trying to learn it all.

Is there a way to dump all the serial print lines, or a log entry out to a file on the PC? or can you only see what is on screen in front of you? I need to figure out (if the app is crashing on the DUO) what actually caused it to crash, and if there is a memory leak, where I plug it!

ard2dee2:
I ran it heavy

What does that even mean?

If you want any advice (other than pure speculation) , surely you should post the sketch here?

Sorry, many sleepless nights catching up with me!

I ran the code without breaks, I have no idea if the code is a lot to handle, or small in comparison to its capabilities!

Anyway, the code is attached, as apparently its exceeding the maximum allowed length of 9000 characters…

Code.txt (8.79 KB)

You still have some ='s that should be =='s

else if (PWMOption = 2)

digitalWrite() is only a 0 or 1

digitalWrite(LED_BUILTIN, x);

This should rather be unsigned long:

long time = 0;

… although even just long is still 2M milliseconds which is over 3 weeks.

ard2dee2:
within a few minutes, the app appeared to hang.

Fwiw, I loaded the sketch from #2 (unchanged) into a Uno, and as I write this it's been running for over 15 minutes, still counting...

Mine's running over half an hour now, and like Johnnie Walker, still going strong....

not just me then! I Know the load takes a while.

I ran the software on the arduino though and within a few minutes, the lights remained static and the serial port ceased receiving data!

ard2dee2:
not just me then!

What do you mean? It's working perfectly for me, and I'm the only other one in this thread.

Still running properly after 45 minutes...

6
 Light On
 Light Off
5
 Light On
 Light Off
4

I Know the load takes a while.

I hardly noticed it load....

Ok I'm unplugging it now, I need the usb socket for something else.

But it ran (presumably) correctly for me on an Uno for just over an hour. It certainly didn't hang, the blinkenlite is blinken and the serial monitor is updating, so what this might have been for you:

within a few minutes, the app appeared to hang.

... I have no clue.

Odd, its now working fine for me too!

I have edited the code as you suggested, hopefully it should start playing nicely!