I was having a problem with my lcd screen.
I didn't have any trouble connecting it or uploading the code to it but only the half of the screen would display text.
I wondered if it were my wire's so I took them off and replaced them for new one's and still half of the screen wasn't displaying.
so I was wondering is the lcd screen broken or did I connect something wrong ?
/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit:
LCD RS pin to digital pin 12
LCD Enable pin to digital pin 11
LCD D4 pin to digital pin 5
LCD D5 pin to digital pin 4
LCD D6 pin to digital pin 3
LCD D7 pin to digital pin 2
LCD R/W pin to ground
LCD VSS pin to ground
LCD VCC pin to 5V
10K resistor:
ends to +5V and ground
wiper to LCD VO pin (pin 3)
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
This example code is in the public domain.
*/
// include the library code: #include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis() / 10);
}
okey so I've noticed that the screen isn't broken so my code is wrong
when wrote a bit of code that higher the number by 1 every 10 ms I could verify that the other half of the screen is capable of displaying numbers
the output now is Hello, W329430
so my question now is: why won't lcd.print("hello, World!); not work? the output would be "hello, W"
instead of "hello, World!". did I specify the size of the screen wrong ?
In the headline you told us it was a 16 pos 1 line LCD, but the 'Hello World' demo deals with a 2 line LCD.
But there has been a lot of problems controlling 1 line displays, so try to search the forum with 'LCD 1601'
and you will see a lot of hints dealing with your display.
Btw. next time you are sending your code, please use the code (/) marks as described in the:
General Guidance and How to use the forum.
It was a while back that I had to use a 1x16 display with Arduino (Uno). If I recall right I set it as a 8x2 display and then to print to the right 8 places I used setCursor(0,1). For more information, Google "Arduino 1x16 LCD".
For even more information Google "LCD Addressing"... or go directly to Don's Collected Technical Information and follow the LCD Addressing link. The 16x1 stuff is near the end.
okey I have found a fix
a 1x16 lcd screen is first of all not ideal
since autoscroll and other functions just act weird
you have to relocate the cursor every 8 characters so the entire display is used
here is my code that just "scrolls" text (the lcd.autoscroll function doesn't work for 1x16 screens)
/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
//lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 0);
lcd.print("hello, W");
lcd.setCursor(0, 1);
lcd.print("orld! ");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("this is ");
lcd.setCursor(0, 1);
lcd.print("a lenght");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("test! ");
lcd.setCursor(0, 1);
delay(1000);
lcd.clear();
}
please note that the delay is necessary or else the display will just show random stuff
groundFungus:
It was a while back that I had to use a 1x16 display with Arduino (Uno). If I recall right I set it as a 8x2 display and then to print to the right 8 places I used setCursor(0,1). For more information, Google "Arduino 1x16 LCD".
If you use the hd44780 library you can use a 8x2 display as if it were a 16x1 display.
The shift left, shift right, and autoshift functions won't work as expected on a 16x1 display but other than that you can write to display and set cursor positions 0-15 as if the display were a 16x1 display.
To enable this with the hd44780 library , simple initialize the display as a 8x2 display then call lineWrap() to enable line wrapping.
This is much easier than having to do all the line splitting and cursor positioning that is required when using the typical "LiquidCrystal" type library.
There is a example in the hd44780 library called LineWrap that shows how this is done.