Pages: [1]   Go Down
Author Topic: Code only runs when programmed. Not after reboot  (Read 501 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey everybody, hopefully this is the right place to post this... I built a project that uses an Arduino Uno, LED, switch, and a 16x2 serial LCD display. Basically, you press the button and the screen will display how you will die. the issue is that if I upload the code to the Uno, it works perfectly. If I disconnect the USB cable or otherwise remove power to the Uno, when it boots up next, nothing happens! I even put serial print commands in the code for debugging, but I don't even get that to show... Nothing will work at all, until of course I re-upload the code. This project needs to be powered on for an entire month, and right now, if there is any power interruption, The project will not function until I reprogram the Uno.

If anybody knows how to help, it would be greatly appreciated.


Notes: (also see attached code)

LCD Screen Pinout
SCREEN         ARDUINO
VSS               GND
VDD              +5v
contrast        resistor-ground
RS                2
R/W             3
enable          4

data4           9
data5           10
data6           11
data7           12
backlight+     +5v
backlight-      gnd


LED
pin 6 to +, led - to resistor/gnd

Button
pin 5

* Jacqui_s_box.pde (3.49 KB - downloaded 6 times.)
Logged

UK, Southwest
Offline Offline
Full Member
***
Karma: 5
Posts: 138
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm on a Windows machine at the moment, so I cannot count the string length easily, but I suspect you are running out of RAM.
Each string declared is stored in Flash, BUT, when the sketch starts, it is all copied at runtime into Flash.

Try with only 2 or 3 strings.

(I reckon your string array is about 1754 characters, you only have 2K total)
« Last Edit: October 03, 2011, 05:19:46 pm by shelleycat » Logged

Offline Offline
Edison Member
*
Karma: 17
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try using PROGMEM: http://www.arduino.cc/en/Reference/PROGMEM
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16514
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Each string declared is stored in Flash, BUT, when the sketch starts, it is all copied at runtime into Flash.

Is that what you meant to write?  smiley-wink
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I didn't try the PROGMEM but i did try shortening down my array from about 150 words or so to just method1, method2, method3. Still, the same problem persists.

And if that isn't weird enough, If I unplug the arduino and plug it back in, about 1 in 100 times it will load the code and work. all the rest of the time it does not. After some more investigation, it even does this with the HelloWorld that is in the LiquidCrystal Example folder!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino on the rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you have the problem even with standard sketches, it is probably not a software problem.

Quote
backlight+     +5v
backlight-      gnd

Could it be the backlight uses too much power for the Arduino regulator? Can you disable it to see what happens?

I had this problem once with a backlit LCD.
« Last Edit: October 04, 2011, 01:57:46 pm by electrickery » Logged

Missouri
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had the same problem with my uno. Turned out to be a bad boot loader, I got a new boot loader emailed from sparkfun reflashed it and was good to go.
Logged

Pages: [1]   Go Up
Jump to: