Can you spot why this isn't working?

Hello,
i wanted to do a little program where i can scroll a single character with a potmeter on my LCD.
This is what i have written:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);

int potVal;
int prevPotVal = 0;
  byte smiley[8] = {
 B00000,
 B10001,
 B00000,
 B00000,
 B10001,
 B01110,
 B00000,
};
int pose = 8;
void setup() {
  Serial.begin(9600);
  lcd.createChar(0,smiley);
  lcd.begin(16,2);
}

void loop() {
  int potVal = analogRead(A0);
  setPose();
  if (potVal != prevPotVal) {
    lcd.clear();
    lcd.setCursor(pose,0);
    lcd.write(byte(0));
  }
  prevPotVal = potVal;
  Serial.print("pose:");Serial.print(pose);
  Serial.print("potval: "),Serial.println(potVal);
}

void setPose() {
  if (potVal < 64) {
    pose = 0;
  } if (potVal >= 64 && potVal < 128) {
    pose = 1;
  } if (potVal >= 128 && potVal < 192) {
    pose = 2;
  }  if (potVal >= 192 && potVal < 256) {
    pose = 3;
  }  if (potVal >= 256 && potVal < 320) {
    pose = 4;
  }  if (potVal >= 320 && potVal < 384) {
    pose = 5;
  }  if (potVal >= 384 && potVal <448) {
    pose = 6;
  }  if (potVal >= 448 && potVal < 512) {
    pose = 7;
  }  if (potVal >= 512 && potVal < 576) {
    pose = 8;  
  }  if (potVal >= 576 && potVal < 640) {
    pose = 9;
  }  if (potVal >= 640 && potVal < 704) {
    pose = 10;
  }  if (potVal >= 704 && potVal < 768) {
    pose = 11;
  }  if (potVal >= 768 && potVal < 832) {
    pose = 12;
  }  if (potVal >= 832 && potVal < 896) {
    pose = 13;
  }  if (potVal >= 896 && potVal < 960) {
    pose = 14;
  }  if (potVal >= 960 && potVal < 1024) {
    pose = 15;
  }
}

I monitored the value of “pose”, and it always puts out 0, no matter what, so for some reason the first if statement is always true, and i dont know why.
please help :slight_smile:

Scope of potVal.

Do I win anything?

Error:

  int potVal = analogRead(A0);

better:

  potVal = analogRead(A0);