good day,
i got problem with my board which is i can't do even a simple display. code that i am using is:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 5, 11, 12, 13, 14);
void setup() {
lcd.begin(16, 2);
}
void loop() {
lcd.print("hello, world!");
delay(500);
lcd.clear();
delay(500);
}
i will attach my schematics diagram and my type of arduino is Arduino TU-001 console shield.
Put your print statement in setup() and remove the delays and the clear which will leave loop() empty between the brackets.
Let us know the results.
Don
Hi Floresta,
Many thanks for the swift reply, it is greatly appreciated!
As the changes you have suggested, I have included my code below. The code is compiling as expected and uploading without issue, however, it is still not outputting the expected "hello, world!"
I have attached an image of the display.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 5, 6, 11, 12, 13, 14);
void setup() {
lcd.begin(16, 2);
lcd.print("hello, world!");
}
void loop() {
}
Once again many thanks for your assistance!
/Kay
The two rows of blocks indicates that your LCD controller is not being initialized properly. This can be due to a problem with the wiring or soldering or with connections that do not agree with the contents of the 'constructor'.
Your LiquidCrystal lcd(...); statement (the constructor) uses different numbers in your two examples and neither is correct since pin numbers are duplicated in each.
According to the diagram that you provided the statement should be:
//LiquidCrystal lcd(RS, RW, E, D4, D5, D6, D7);
LiquidCrystal lcd(2, 3, 10, 4, 5, 6, 7); // put your pin numbers here
Don
Hi Floresta,
Thanks, what you suggested appeared to have worked
Out of curiosity, where did these values you used in the constructor come from because what I was using on the specification were the connections on the LCD display. This will help me in the future understand
Once again many thanks for the assistance.
/Kay
Any of the Arduino I/O (input/output) pins can be used to drive any of the LCD display lines. Other devices frequently require the use of specific Arduino I/O pins. Generally speaking you would assign Arduino I/O pins for those devices first and then use any of the remaining available pins for your display.
The designations of RS, RW, E, etc. are how the display manufacturers identify the I/O pins on their devices. The designations may vary slightly from manufacturer to manufacturer but they will be similar.
The numerical designations 2, 3, 10 etc. are the ones used on the Arduino 'digital' pins. The so called 'analog' pins can be used as well, the designations are A0, A1, ... A5 or 14, 15, ... 19).
I simply (?) used your circuit diagram and followed each display pin back to the Arduino to see where it was connected. Note that the library always expects the pins to be in the order shown in my comment above so you just list the pins that you are using in the same order.
Also note that most circuits do not implement the RW line. LCD pin 5 is connected to GND and the Arduino pin number is simply omitted from the 'list' in the constructor statement. The library can tell the difference when it sees only six entries instead of seven.
Don
In your original constructor other than the first parameter (the first #12), your parameters appear to be the lcd module pins for the given signal. (rs is actually lcd module pin #4 not #12)
But....
what Don was saying is that the numbers in the LiquidCrystal constructor tell the library which arduino pin # is connected to that LCD signal not which LCD pin module pin # is used for that signal.
floresta:
Also note that most circuits do not implement the RW line. LCD pin 5 is connected to GND and the Arduino pin number is simply omitted from the 'list' in the constructor statement. The library can tell the difference when it sees only six entries instead of seven.
Not only that, but the LiquidCrystal library that comes bundled with the IDE does not use the pin assigned to the RW signal for anything other than a ground so there is no value in using using an arduino pin for this.
In other words, since there is no difference in using a wire connection from the LCD RW signal to ground vs using an arduino pin, it is a waste of an arduino pin to assign one to the RW signal.
--- bill