SparkFun will be closed May 25, 2015 for Memorial Day. Orders placed after 2pm on Friday the 22nd will ship out on Tuesday. Thanks!
Frequently Asked Questions
Mon-Fri, 9am to 5pm
U.S. Mountain Time:
Chat With Us
June 20, 2013
about 2 years ago
I have a serial LCD-10097 interfaces with Arduino Mega 2560. When I run a sample code to test the LCD, it does not seem to line up as the position 1, line 1, or the position 1, line 2.
Here is the sample code I got from Sparkfun;
// SparkFun Serial LCD example 2
// Format and display fake RPM and temperature data
// This sketch is for Arduino versions 1.0 and later
// If you’re using an Arduino version older than 1.0, use
// the other example code available on the tutorial page.
// Use the softwareserial library to create a new “soft” serial port
// for the display. This prevents display corruption when uploading code.
// Attach the serial display’s RX line to digital pin 2
SoftwareSerial mySerial(3,2); // pin 2 = TX, pin 3 = RX (unused)
mySerial.begin(9600); // set up serial port for 9600 baud
delay(500); // wait for display to boot up
mySerial.write(254); // cursor to beginning of first line
mySerial.write(“RPM: ”); // clear display + legends
int temp, rpm;
char tempstring, rpmstring; // create string arrays
temp = random(1000); // make some fake data
rpm = random(10000);
sprintf(tempstring,“%4d”,rpm); // create strings from the numbers
sprintf(rpmstring,“%4d”,temp); // right-justify to 4 spaces
mySerial.write(254); // cursor to 7th position on first line
mySerial.write(rpmstring); // write out the RPM value
mySerial.write(254); // cursor to 7th position on second line
mySerial.write(tempstring); // write out the TEMP value
delay(1000); // short delay
Please help me.
Thank you very much.
For this serial LCD to work correctly with my Arduino Mega, would my Arduino software version 1.0.5 work correctly between the Mega and this serial LCD?
Have a great day!
No public wish lists :(
Forgot your password?
No account? Register one!