"L" light flashes, program restarts

I'm running a program interfacing with an LED display. I have a simple script running in void loop() that just continually spits out numbers. After only 7 iterations or so, the "L" light blinks, and the board restarts.

I realize I'm being vague, and I can get more specific as necessary, but generally what causes the board to up and restart?

I realize I'm being vague,

So, quit being vague - show us the "simple script", show us the circuit.

but generally what causes the board to up and restart?

Overheating, hitting the reset button, running out of memory, voltage dips, EMI, ESD ...lots of stuff.

What's an "L" light?

What's an "L" light?

Pin 13's built-in LED has the legend "L" printed next to it on the PCB.

I can get more specific as necessary

Does your sketch do anything with pin 13 intentionally? AWOL is right, the entire sketch would be helpful here.

#include <LedDisplay.h>



// Define pins for the LED display. 



#define dataPin 6              // connects to the display's data in

#define registerSelect 7       // the display's register select pin 

#define clockPin 8             // the display's clock pin

#define enable 9               // the display's chip enable pin

#define reset 10               // the display's reset pin



#define displayLength 8        // number of characters in the display



// create an instance of the LED display library:

LedDisplay d1 = LedDisplay(dataPin, registerSelect, clockPin, 

enable, reset, displayLength);



int brightness = 15;        // screen brightness



void setup() {

  

  // initialize the display library:

  d1.begin();

 

  // set the brightness of the display:

  d1.setBrightness(brightness);

 

}



void loop() {



//set cursor to 0 position

  d1.home();



//print cursor position in each respective position    

  for (int i = 0; i < 8; i++){

   d1.print(d1.getCursor());

   delay(500);

  }



//clear display

  d1.clear();   

 

}

there is no direct manipulation of pin 13.
this program is using the LedDisplay library to talk to an HCMS-2915 8 character led display.
ideally the program would write to the display, one character at a time
01234567
then clear, and begin writing again.
when it gets to 6, the pin 13 LED (or L light as I confusingly called it) blinks, and the program restarts, clearing the display, and starting from 0.
i'm externally powering the display, and I'm running the arduino off of the USB power.

upon further investigation, i've discovered a few things.
if i say
d1.print((long) d1.getCursor());
i don't have a problem.
getCursor() returns an int.
according to Print.cpp, the included Arduino library, when print receives and int it does the following
void Print::print (int n)
{
print ((long) n);
}

any idea why it works when i explicitly tell it to (long). shouldn't print be able to handle this?

also, if i tell it to
d1.print("01234567")
i get a garbage character instead of the 7
but if explicitly send each character to write
d1.write('0');
d1.write('1);
etc
the 7 comes out fine.

as i understand print(); if you send a string, it basically just parses the string and sends each character to write();
any idea why print(); would fail, but sending each character to write() explicitly would work?

Pin 13's built-in LED has the legend "L" printed next to it on the PCB.

Must be young, us old beggers with aging eyes can't see such detail............ :slight_smile:

shouldn't print be able to handle this?

Some of the library functions caution about using something other than constants and single variables as parameters to the functions. For example, Print cautions "Be careful about doing math inside the brackets" (Serial.print() - Arduino Reference - see "Programming Tips / Known Issues" at the bottom of that page). I presume the same caution applies to using the results of other functions as a parameter, which is what the case is here. Try replacing

d1.print(d1.getCursor());

with

int j = d1.getCursor();
** d1.print(j);**

any idea why print(); would fail, but sending each character to write() explicitly would work?

The end of that same section (referenced above) also cautions "The Serial.print function puts data into a buffer. It will wait for one character to send, before going on to the next character. However the function returns before sending the last character. " Maybe there is something weird about its interaction with the LedDisplay library that is causing that behavior. Dunno, it's got me stumped too.

Pin 13's built-in LED has the legend "L" printed next to it on the PCB.

Must be young, us old beggers with aging eyes can't see such detail............

Well, you can't say they didn't give you a fair chance. They did make it an upper-case "L". ;D