LCD Potentiometer help.

So I have a 2 x 16 sainsmart LCD and I am just playing around with it. I have successfully mapped down the potentiometer reading to a number from 1 - 10 and it is displayed on the LCD. The problem is that the potentiometer is constantly being read by the program and hence fills up the display when I only want one character to be used.

How can I tell the arduino to stop the analogReading when the potentiometer is not being changed?

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

const int potPin = A0;
int currentPotValue;




void setup() {
  lcd.begin(16,2);
  lcd.backlight();
  lcd.setCursor(0,0);
   
}

void loop() {
  currentPotValue = map(analogRead(potPin), 0, 1024, 0, 10);
  lcd.print(currentPotValue);
  delay(1000);




}

Maybe setting the cursor back to 0,0 before printing the next value would be a start, if not the complete answer, as you may find when you try it.

Good idea, thank you:)

If you used setCursor() to put the cursor at 0,0 before printing the value in the range 1-10 have you found the problem that it causes ?

yep that solves it, thank you :slight_smile:

Did you use just
lcd.setCursor(0,0);to position the cursor and if so have you tried printing a value of 10 followed by a lower value ?