Happy new year everyone. I need help figuring out why the code listed below wont change the location of the letter x on my LCD.
#include <LiquidCrystal.h> //the liquid crystal library contains commands for printing to the display
LiquidCrystal lcd(13, 12, 11, 10, 9, 8); // tell the RedBoard what pins are connected to the display
int potentiometer = A0; //the temperature in Fahrenheit, calculated from the voltage
void setup() {
Serial.begin(9600); //start a serial connection with the computer
lcd.begin(16, 2); //tell the lcd library that we are using a display that is 16 characters wide and 2 characters high
lcd.clear(); //clear the display
}
void loop() {
potentiometer = analogRead(A0);
Serial.print(" Potentiometer value:");
Serial.println(potentiometer);
lcd.clear(); //clear the LCD
if (potentiometer > 0 && potentiometer <= 150)
{lcd.setCursor(0, 0);
lcd.print("X") ;}
if (potentiometer > 150 && potentiometer <= 300)
{lcd.setCursor(4, 0);
lcd.print("X") ;}
if (potentiometer > 300 && potentiometer <= 450)
{lcd.setCursor(8, 0);
lcd.print("X") ;}
if (potentiometer > 450 && potentiometer <= 600)
{lcd.setCursor(12, 0);
lcd.print("X") ;}
if (potentiometer > 600 && potentiometer <= 750)
{lcd.setCursor(8, 1);
lcd.print("X") ;}
if (potentiometer > 750 && potentiometer <= 900)
{lcd.setCursor(4, 1);
lcd.print("X") ;}
if (potentiometer > 900)
{lcd.setCursor(1, 1);
lcd.print("X") ;}
delay (500);
}
What value(s) are you seeing on the serial port?
I connected a 1602 LCD and a pot to my Uno and ran your code. The X moves around as expected.
Does the X show up at all? What does the LCD show?
As bperrybap asks, what do you see on serial monitor?
Read the how get the most out of this forum sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code in code tags.
Here is your code formatted and posted in code tags.
#include <LiquidCrystal.h> //the liquid crystal library contains commands for printing to the display
LiquidCrystal lcd(13, 12, 11, 10, 9, 8); // tell the RedBoard what pins are connected to the display
int potentiometer; //the temperature in Fahrenheit, calculated from the voltage
void setup()
{
Serial.begin(9600); //start a serial connection with the computer
lcd.begin(16, 2); //tell the lcd library that we are using a display that is 16 characters wide and 2 characters high
lcd.clear(); //clear the display
}
void loop()
{
potentiometer = analogRead(A0);
Serial.print(" Potentiometer value:");
Serial.println(potentiometer);
lcd.clear(); //clear the LCD
if (potentiometer > 0 && potentiometer <= 150)
{
lcd.setCursor(0, 0);
lcd.print("X") ;
}
if (potentiometer > 150 && potentiometer <= 300)
{
lcd.setCursor(4, 0);
lcd.print("X") ;
}
if (potentiometer > 300 && potentiometer <= 450)
{
lcd.setCursor(8, 0);
lcd.print("X") ;
}
if (potentiometer > 450 && potentiometer <= 600)
{
lcd.setCursor(12, 0);
lcd.print("X") ;
}
if (potentiometer > 600 && potentiometer <= 750)
{
lcd.setCursor(8, 1);
lcd.print("X") ;
}
if (potentiometer > 750 && potentiometer <= 900)
{
lcd.setCursor(4, 1);
lcd.print("X") ;
}
if (potentiometer > 900)
{
lcd.setCursor(1, 1);
lcd.print("X") ;
}
delay (500);
}
Heres what i got. Pot comes back as expected.


The pot is not connected to anything. The rails do not continue across the groove in the middle. Move the wires across the groove to the holes in the red box.

Pot comes back as expected.
What does that mean? It makes no sense to me.
Please answer all the questions asked.

Thank you! now the x shows up on screen but it doesnt move. What i meant was when i used the serial monitor large numbers showed up when i moved the potentiometer. I assumed that ment it was connected lol (im new at this sorry).
Make sure that the pot is wired as shown. You should see readings in serial monitor from 0 to 1023 as the pot is turned.


That does it! Thank you so much for your help. 
Yay! Happy that it works.