Devantech LD03/05 LCD with Arduino Diecimila

Hey everyone,

I’m trying to get the SoftwareSerial class to work with my LCD. I can get the display to work decent, but it’s not very stable. All I have hooked up is grnd, 5v, and Rx (i.e., Tx is disconnected because I don’t see a use for it atm). Below is my code:

#include <Servo.h> 
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>

Servo myservo;  // create servo object to control a servo 
// a maximum of eight servo objects can be created 

int pos = 90;    // variable to store the servo position 

SoftwareSerial LCD(NOT_A_PIN, 4);  //LCD display


void setup() 
{ 
  myservo.attach(A1);  // attaches the servo on pin 9 to the servo object 
  LCD.begin(9600);
   
} 


void loop() 
{ 
  LCD.write(12);
  LCD.write(13);
  LCD.write(9);
  LCD.write(9);
  LCD.print("Progress!");
  LCD.end();

  delay(2000);
}

So basically, this clears the screen, sets the cursor to about center on the 2nd line (cr, tab, tab), and prints Progress!. This works decently, but it seems like every 5 or so loops through this, the backlight flashes and the startup screen displays before going back to “Progress!” with no backlight. Any ideas why?

What is the significance of your magic numbers?

Why do you have the code in a loop if none of the information is changing?

Don

floresta:
What is the significance of your magic numbers?

Why do you have the code in a loop if none of the information is changing?

Don

Sorry, I'm using this datasheet: http://www.robotshop.com/content/PDF/datasheet-lcd05-20-4-green.pdf
If I don't have the code in a loop, it just displays my data and then returns to the default bootup screen.

Q. What is the significance of your magic numbers?
A. Sorry, I'm using this datasheet: ...

I don't see how this answers the question. How will we know whether you picked the correct magic number for a particular step when we don't know what you are trying to do at that point. That is the purpose of adding comments to your code.

If I don't have the code in a loop, it just displays my data and then returns to the default bootup screen.

You can't effectively troubleshoot this problem with your LCD code in loop(). Put those lines in setup() and look for what is causing your basic problem. First of all you should remove all of the stuff relating to the servo and see if the LCD works by itself.

Don