I don't really know what I am misunderstanding here, can somebody help?

I know the title sounds weird, but it’s really true. I have NO IDEA why this is happening.

The problem is that once I remove one, seemingly, useless line from my project, my 16x2 LCD screen doesn’t listen to the clear command anymore. The two statements have nothing to do with each other as far as I know.

Here is the RELEVANT bit of my code:

void loop() {
  buttonState = digitalRead(buttonPin);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);
  Serial.println("Test");

  if (buttonState == LOW)
  {
    digitalWrite(led1Pin, LOW);
  }
  else {
    lcd.clear();
    buttonState = digitalRead(buttonPin);
    b1= true;
    digitalWrite(led1Pin, HIGH);
    delay(200);
    digitalWrite(led1Pin, LOW);
    delay(200);
    digitalWrite(led1Pin, HIGH);
    delay(200);
    digitalWrite(led1Pin, LOW);
    delay(200);
    digitalWrite(led1Pin, HIGH);
    delay(200);
    digitalWrite(led1Pin, LOW);
    delay(200);
    digitalWrite(led1Pin, HIGH);
    lcd.print("Alarm:Drugsafval                        in Breda!");
    buzz();
  }

}

The line I am talking about is Serial.println(“Test”);
It was solely for testing purposes but now my entire project is ruined when I delete it.
Any ideas?

Here is my full code for if you wish

#include <LiquidCrystal.h>

LiquidCrystal lcd(1, 2, 4, 5, 6, 7);
const int buttonPin = 8;
const int led1Pin =  13;
const int buttonPin2 = 9;
const int led2Pin = 12;
const int buttonPin3 = 10;
const int led3Pin = 11;
const int buzzer= 3;
bool b1= false;
bool b2= false;
bool b3= false;

int buttonState = 1;
int buttonState2 = 1;
int buttonState3 = 1;

void buzz(){
     tone(buzzer, 600);
    delay(500);
    noTone(buzzer);
    delay(500);
    tone(buzzer, 600);
    delay(500);
    noTone(buzzer);
    delay(500);
    tone(buzzer, 600);
    delay(500);
    noTone(buzzer);
    delay(500);
    tone(buzzer, 600);
    delay(500);
    noTone(buzzer);
    delay(500);
    tone(buzzer, 600);
    delay(500);
    noTone(buzzer);
    delay(500);
    tone(buzzer, 600);
    delay(500);
    noTone(buzzer);
}

void setup() {
  pinMode(led1Pin, OUTPUT);
  pinMode(buttonPin, INPUT_PULLUP);
  pinMode(led2Pin, OUTPUT);
  pinMode(buttonPin2, INPUT_PULLUP);
  pinMode(led3Pin, OUTPUT);
  pinMode(buttonPin3, INPUT_PULLUP);
  pinMode(buzzer,OUTPUT);
  lcd.begin(16, 2);
  lcd.print("Er is momenteel                        geen alarm!");
  Serial.begin(9600);
}

void loop() {
  buttonState = digitalRead(buttonPin);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);
  Serial.println("Test");

  if (buttonState == LOW)
  {
    digitalWrite(led1Pin, LOW);
  }
  else {
    lcd.clear();
    buttonState = digitalRead(buttonPin);
    b1= true;
    digitalWrite(led1Pin, HIGH);
    delay(200);
    digitalWrite(led1Pin, LOW);
    delay(200);
    digitalWrite(led1Pin, HIGH);
    delay(200);
    digitalWrite(led1Pin, LOW);
    delay(200);
    digitalWrite(led1Pin, HIGH);
    delay(200);
    digitalWrite(led1Pin, LOW);
    delay(200);
    digitalWrite(led1Pin, HIGH);
    lcd.print("Alarm:Drugsafval                        in Breda!");
    buzz();
  }


  if (buttonState2 == LOW)
  {
    digitalWrite(led2Pin, LOW);
  }
  else {
   

lcd.clear();
    buttonState2 = digitalRead(buttonPin2);
    b2=true;
    digitalWrite(led2Pin, HIGH);
    delay(200);
    digitalWrite(led2Pin, LOW);
    delay(200);
    digitalWrite(led2Pin, HIGH);
    delay(200);
    digitalWrite(led2Pin, LOW);
    delay(200);
    digitalWrite(led2Pin, HIGH);
    delay(200);
    digitalWrite(led2Pin, LOW);
    delay(200);
    digitalWrite(led2Pin, HIGH);
    lcd.print("Alarm:Drugsafval                        in Tilburg!");
    buzz();
  }
  if (buttonState3 == LOW)
  {
    digitalWrite(led3Pin, LOW);
  }
  else {
   

lcd.clear();
    buttonState3 = digitalRead(buttonPin3);
    b3=true;
    digitalWrite(led3Pin, HIGH);
    delay(200);
    digitalWrite(led3Pin, LOW);
    delay(200);
    digitalWrite(led3Pin, HIGH);
    delay(200);
    digitalWrite(led3Pin, LOW);
    delay(200);
    digitalWrite(led3Pin, HIGH);
    delay(200);
    digitalWrite(led3Pin, LOW);
    delay(200);
    digitalWrite(led3Pin, HIGH);
     lcd.print("Alarm:Drugsafval                        in Oss!");
    buzz();
  }

}

On most boards, pins 0 and 1 are used by the USB serial interface, so you can't also use them for the LCD if you want to be able to Serial.print.

GypsumFantastic:
On most boards, pins 0 and 1 are used by the USB serial interface, so you can’t also use them for the LCD if you want to be able to Serial.print.

Thanks! It worked :slight_smile:

From now on I will not wire on 1 again haha

You're welcome. I think it's a mistake every Arduino-beginner makes at some point.