Somehow it only prints 16 chars per line. Dunno why?
http://img8.imageshack.us/img8/6742/s6300886j.jpg
Code:
#include <NewSoftSerial.h>
NewSoftSerial mySerial(7, 8);
void setup()
{
mySerial.begin(9600);
}
void loop() {
// Example usage:
clearLCD();
backlightOn();
//Print text on each line
selectLineOne();
delay(100);
mySerial.print("AAAAAAAAAAAAAAAAAAAA");
delay(10000);
}
//SerialLCD Functions
void selectLineOne(){ //puts the cursor at line 0 char 0.
mySerial.print(0xFE, BYTE); //command flag
mySerial.print(128, BYTE); //position
}
void selectLineTwo(){ //puts the cursor at line 2 char 0.
mySerial.print(0xFE, BYTE); //command flag
mySerial.print(192, BYTE); //position
}
void selectLineThree(){ //puts the cursor at line 3 char 0.
mySerial.print(0xFE, BYTE); //command flag
mySerial.print(148, BYTE); //position
}
void selectLineFour(){ //puts the cursor at line 4 char 0.
mySerial.print(0xFE, BYTE); //command flag
mySerial.print(212, BYTE); //position
}
void clearLCD(){
mySerial.print(0xFE, BYTE); //command flag
mySerial.print(0x01, BYTE); //clear command.
}
void backlightOn(){ //turns on the backlight
mySerial.print(0x7C, BYTE); //command flag for backlight stuff
mySerial.print(157, BYTE); //light level.
}
void backlightOff(){ //turns off the backlight
mySerial.print(0x7C, BYTE); //command flag for backlight stuff
mySerial.print(128, BYTE); //light level for off.
}
void backlight50(){ //sets the backlight at 50% brightness
mySerial.print(0x7C, BYTE); //command flag for backlight stuff
mySerial.print(143, BYTE); //light level for off.
}
void serCommand(){ //a general function to call the command flag for issuing all other commands
mySerial.print(0xFE, BYTE);
}
And! how come this 20x4 needs some delay? Or else it won’t show anything. The 16x2 lcd I got just prints it without the need for a delay.