I'm trying to print an int on both an LCD and the Serial Monitor, but its only being displayed on the LCD. The Serial Monitor is printing question marks.

Here is my Arduino code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(1, 2, 4, 5, 6, 7);
int x = 10;

void setup()
  lcd.begin(16, 2);

void loop()
  lcd.setCursor(0, 0);
  Serial.print(x); // print Serial
  • reduce your code to print to serial monitor only and try again .... post your results .... note: question mark ? .... exclamation mark ! – jsotola Jul 8 '18 at 0:10

If you are using clasical UNO, then pins 0 and 1 are Serial. Declaring lcd(1,... make LCD use the pin 1 too, so Serial is confused and garbled.

Use other pins for lcd and adjuct the wires acordingly.

  • 1
    @aloush You should select the green tick next to the vote button in the left if you think this answer solved your problem. – goodarduinocode Jul 8 '18 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.