LCD will just absolutely not work [wrong wiring]

I am very frustrated right now. Every time I use my LCD screen, after like 2 tries, it starts corrupting with random characters. Ive tried switching pins, ive tried writing different code, nothing is working. Can somebody please help me with this??

/*
* Arduino LCD Tutorial
*
* Crated by Dejan Nedelkovski,
* www.HowToMechatronics.com
*
*/

#include <LiquidCrystal.h> // includes the LiquidCrystal Library 
LiquidCrystal lcd(1, 2, 4, 5, 6, 7); // Creates an LCD object. Parameters: (rs, enable, d4, d5, d6, d7) 

const char BUTTON_PIN = 9;
bool pressed = false;

void setup() { 
 Serial.begin(115200);
 pinMode(BUTTON_PIN, INPUT_PULLUP);

 lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display } 
 lcd.print("SMALLOS 2.0");
}

void loop() { 
  bool currentState = digitalRead(BUTTON_PIN);

  if (currentState == pressed) {
    Serial.println("Hello");
    while(digitalRead(BUTTON_PIN) == pressed) {

    }
  }
}

LiquidCrystal lcd(1, 2, 4, 5, 6, 7);

Using pin 1 on many Arduinos is not a good idea because it is used by the Serial interface

Which Arduino are you using ?

2 Likes

I'll try switching the pins. Im using a mega 2560 from Elegoo which is compatible with Arduino software (hence why I posted here).

The Mega uses pin 1 for Serial

I just switched it, thank you so much. I wish I knew that lol

Glad you got it working

Are pins 0 and 1 labelled with anything other than 0 and 1 on your Mega ?

I didn't really look at that because im very new to circuit boards

TX0>1
RX0<0

TX0 indicates that pin 1 is the Transmit pin for the Serial interface

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.