Skip to content

LCD examples reference to SPI (fixed pins) not needed, unnecessary limitation to usersΒ #638

Open
@Brimbard

Description

@Brimbard

In the demos https://docs.arduino.cc/learn/electronics/lcd-displays#hello-world-example it is stated

As the Arduino is communicating with the display using SPI, pin 11 & 12 will change depending on what board you are using.

I could not find any reference to the SPI-module in the LiquidCrystal library. Please let me know if I may have overlooked something!

But, I successfully replaced the lines:

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

with:

#define RS_PIN 3
#define E_PIN  4
#define D4_PIN 5
#define D5_PIN 6
#define D6_PIN 7
#define D7_PIN 8
// 4 bit mode, connect RW to gnd, V0 gnd or variable resistor, 
// D0..D3 left open
// Backlight: K to gnd, A via 330 Ohm to +5V
LiquidCrystal lcd(RS_PIN, E_PIN, D4_PIN, D5_PIN, D6_PIN, D7_PIN);

This was successfully tested for all given examples (Autoscroll, Blink, Cursor, CustomCharacter, Display, Hello World, Scroll, SerialDisplay, setCursor, TextDirection) on a Nano-board and also on an Uno-board.

I would like to suggest removing this irritating reference (SPI would e.g., need a clock signal as well, CS (E_PIN) is usually not predefined, etc.) from the text and adjust the examples to indicate the freedom of choice for the pins.

PS: while the display showed reasonable contrast with the Nano and connecting V0 to ground, I had to use a variable resistor when connecting it to the Uno-board. The LCD got lit up so bright that no character could be recognized.

Also, on the SerialDisplay example a short hint for the user to switch off 'line end' and 'carriage return' might avoid some confusion for less experienced readers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcommunityBugs and fixes suggested by the communitymaker

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions