Pages: [1]   Go Down
Author Topic: "L" light flashes, program restarts  (Read 1255 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24310
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I realize I'm being vague,
So, quit being vague - show us the "simple script", show us the circuit.

Quote
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?
« Last Edit: September 25, 2009, 04:12:05 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 388
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Quote
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.
« Last Edit: September 25, 2009, 09:35:52 pm by TBAr » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:

#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.
« Last Edit: September 28, 2009, 12:59:20 pm by onebigdoor » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Lancashire, UK
Offline Offline
Edison Member
*
Karma: 8
Posts: 1992
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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............   smiley
Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 388
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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" (http://www.arduino.cc/en/Serial/Print - 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);



Quote
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.
« Last Edit: September 28, 2009, 08:52:03 pm by TBAr » Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 388
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Quote
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
Logged

Pages: [1]   Go Up
Jump to: