How do i get the text on the 16 x 2 LCD screen to not scroll.
The display text is less than 16 characters so there is no need for the scroll to happen i just want text to display followed by a variable value and stay in a fixed position.
Iv tried Google but all the questions are asking how to make text scroll which is what im trying to avoid
LCD.setCursor(0,0); // Set Text Location Row 1
LCD.clear();
LCD.print ("DIST : "); // Print String
LCD.print (DISTANCE); // Print Variable
LCD.print (" cm"); // Print Unit
delay(200);
You have not described enough for us to be able to answer your questions.
We need details like what specific lcd you are using and the full code you are using so we can see what library you are using to control it and how you are initializing the library and the lcd.
I don't see anything in your setup() and loop() code that would cause a scrolling issue.
However, you are using pin 1 to control the LCD.
Arduino pins 0 & 1 are used by the serial port on many Arduino boards so it is best to avoid using those pins.
Here is a link that shows the pin uses on some of the Arduino boards.
Oh, and you said it was 16x2 but you initialized it as 16x1.
Could using Pin1 possibly be causing the scrolling ? I do not have any other Pins available they are being used for IO.
I forgot to swap the (16,1) back i was experimenting with changing this as i had the text scrolling across both rows and this was the only way i could prevent it and keep it solely on the first row.
mtom1991:
I wasn't aware I could use the analog pins as digital pins ??
I thought as much.
Common misunderstanding. A0 to A5 (On the ATmegaxx8) are simply digital pins with added analog functionality. A6 and A7 on a Nano (which is what you should be using for any serious project, not a UNO) or Pro Mini are however analog inputs only.
You will often want to use I2C to work with "port expander" and sensor modules - such as the LCD backpack mentioned, they form a common bus to which many devices can be connected together, so it is a good idea to reserve them for that purpose.
Pins 0 and 1 are the serial interface for downloading code and communication with the serial monitor or other communications arrangements, so you really do not want to try and use them for other I/O.
Paul__B:
Common misunderstanding. A0 to A5 (On the ATmegaxx8) are simply digital pins with added analog functionality. A6 and A7 on a Nano (which is what you should be using for any serious project, not a UNO) or Pro Mini are however analog inputs only.
A common misunderstanding brought about by way Arduino describes pins as "analog pins" and "digital pins" - I have never understood what the hell they were thinking, as it confuses a large portion of new arduino users.
I think A6 and A7 on the SMD version of the atmega x8 series are the only analog-only pins in the entire AVR product line...