4 digit 7 segment dispaly

#define LATCH_pin 4
#define CLK_pin 7
#define DATA_pin 8
const byte digits[] =
{192,249,164,176,153,146,130,248,128,144,64,121,36,48,25,18,2,120,0,16,255,
127};

void setup() {
pinMode(A0, INPUT);
pinMode(LATCH_pin, OUTPUT); pinMode(CLK_pin, OUTPUT);
pinMode(DATA_pin, OUTPUT); randomSeed(analogRead(0));
Serial.begin(9600);
}
int n; byte b=0; char c;
void loop() {
  Serial.println(analogRead(A0)); 
  delay(10);
  if (Serial.available()) {
if (b==0) n=0;
c=Serial.read();
if ((c!='\n')&&(b<4)) {n=n*10+(c-48); b++;}
if (c=='\n') b=0;
}
writeNumber(n);
}
void writeDigit(byte Value, byte Pos){
digitalWrite(LATCH_pin, LOW);
shiftOut(DATA_pin, CLK_pin, MSBFIRST, digits[Value]);
shiftOut(DATA_pin, CLK_pin, MSBFIRST, Pos);
digitalWrite(LATCH_pin, HIGH); }
void writeNumber(int Value){
byte n;
for(byte i=8;i>0;i=i/2)
{
n = Value % 10;
if (n == 0) if (Value / 10 > 0) n = 0; else n = 20;
writeDigit(n, i);
Value = Value / 10; 
}
}

hello, guys I’m trying to display data from my serial monitor to the 4 digit 7 segment display but its only display in the serial monito. what might be the problem with my codes? I’ve connected the 4 digit 7 segment display to 2- 8 bit shift register (74HC595) and a potentiometer as the analog input.
any suggestions might help me, coz am trying to display values from the potentiometer to the 4 digit 7 segment display. kindly help me out.

+1 karma for using code tags.

Please auto-format your code and post it again. Hopefully that will make it a little easier to read.

Also please post a schematic of your circuit. We don't want to waste time fixing your code if the circuit will soon burn out.

Also explain what value you are attempting to display: the pot reading or a number keyed into serial monitor?

#define LATCH_pin 4
#define CLK_pin 7
#define DATA_pin 8
const byte digits[] =
{ 192, 249, 164, 176, 153, 146, 130, 248, 128, 144, 64, 121, 36, 48, 25, 18, 2, 120, 0, 16, 255,
  127
};

void setup() {
  pinMode(A0, INPUT);
  pinMode(LATCH_pin, OUTPUT); pinMode(CLK_pin, OUTPUT);
  pinMode(DATA_pin, OUTPUT); randomSeed(analogRead(0));
  Serial.begin(9600);
}
int n; byte b = 0; char c;
void loop() {
  Serial.println(analogRead(A0));
  delay(10);
  if (Serial.available()) {
    if (b == 0) n = 0;
    c = analogRead(A0);
    if ((c != '\n') && (b < 4)) {
      n = n * 10 + (c - 48);
      b++;
    }
    if (c == '\n') b = 0;
  }
  writeNumber(n);
}
void writeDigit(byte Value, byte Pos) {
  digitalWrite(LATCH_pin, LOW);
  shiftOut(DATA_pin, CLK_pin, MSBFIRST, digits[Value]);
  shiftOut(DATA_pin, CLK_pin, MSBFIRST, Pos);
  digitalWrite(LATCH_pin, HIGH);
}
void writeNumber(int Value) {
  byte n;
  for (byte i = 8; i > 0; i = i / 2)
  {
    n = Value % 10;
      if (n == 0) if (Value / 10 > 0) n = 0; else n = 20;
    writeDigit(n, i);
    Value = Value / 10;
  }
}

I’m trying to display values from 0 to 1023 from the pot

Your code does not display the value from the pot, it displays a number read from serial monitor. You need to change that.

Please post that schematic for further help.