1

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);
 Serial.begin(9600);
}
void loop()
{
 x++;
 lcd.setCursor(0, 0);
 lcd.print(x);
 Serial.print(x); // print Serial
}
per1234
4,2782 gold badges23 silver badges43 bronze badges
asked Jul 8, 2018 at 0:01
1
  • reduce your code to print to serial monitor only and try again .... post your results .... note: question mark ? .... exclamation mark ! Commented Jul 8, 2018 at 0:10

1 Answer 1

6

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.

answered Jul 8, 2018 at 0:16
1
  • 1
    @aloush You should select the green tick next to the vote button in the left if you think this answer solved your problem. Commented Jul 8, 2018 at 12:03

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.