I don't know what's wrong with this code that bugging me, here's the code can any one find the error? this is the code for 128x64glcd oscilloscope

#include <U8glib.h>
U8GLIB_KS0108_128 u8g(2, 3, 4, 5, 6, 7, 8, 9, A3, A4, A5, A1, A2);
int Input = A0;
int Key_add = 0;
int Key_sub = 1;
int Key_hold = 10;
int x,y;
int i,i1,i2,V_min,V_max,V_mid,t,t0,t1,sta,Key=1,hold=0;
long Freq;
float Vpp;
int Y[96];
int Buffer[192];

void setup( )
{
pinMode(Key_add,INPUT);
digitalWrite(Key_add,HIGH);
pinMode(Key_sub,INPUT);
digitalWrite(Key_sub,HIGH);
pinMode(Key_hold,INPUT);
digitalWrite(Key_hold,HIGH);
ADMUX=0x60;
ADCSRA=0xe2;
analogReference(INTERNAL);
}

void loop( )
{
sample( );
Measure( );
Transform( );
Key_scan( );
draw();
if(hold==0)
{
u8g.firstPage( );
do
{
draw( );
}
while( u8g.nextPage( ));
}
}

void sample( )
{ for(i = 0;i < 192;i++)
{
Buffer[i] = ADCH;
switch(Key)
{
case 1:
break;
case 2:
delayMicroseconds(4);
break;
case 3:
delayMicroseconds(10);
break;
case 4:
delayMicroseconds(23);
break;
case 5:
delayMicroseconds(60);
break;
case 6:
delayMicroseconds(123);
break;
case 7:
delayMicroseconds(248);
break;
case 8:
delayMicroseconds(623);
break;
case 9:
delayMicroseconds(1247);
break;
default:break;
}
}
}

void Measure()
{
V_max=Buffer[0];
V_min=Buffer[0];
for(i=0;i<192;i++)
{
if(Buffer[i]>V_max)
V_max=Buffer[i];
if(Buffer[i]<V_min)
V_min=Buffer[i];
}
V_mid=(V_max+V_min)/2;
Vpp=(V_max-V_min)*5/255;
for(i=0;i<97;i++)
{
if(Buffer[i]<V_mid&&Buffer[i+1]>=V_mid)
{
i1=i;
break;
}
}
for(i=i1+1;i<98+i1;i++)
{
if(Buffer[i]<V_mid&&Buffer[i+1]>=V_mid)
{
i2=i;
break;
}
}
t=i2-i1;
if(t>0)
Freq=8000/t;
else
Freq=0;
}

void Transform( )
{
for(sta=0;sta<96;sta++)
{
if(Buffer[sta]<128&&Buffer[sta+2]>128)
break;
}
for(i = 0;i < 96;i++)
Y[i] = 63-(Buffer[i+sta]>>2);
}

void draw( )
{
for(x = 0;x < 95;x++)
u8g.drawLine(x,Y[x],x,Y[x+1]);

u8g.drawFrame(0,0,97,64);

u8g.drawLine(48,0,48,63);
u8g.drawLine(0,32,96,32);
for(x=0;x<96;x+=8)
u8g.drawLine(x,31,x,33);
for(y=0;y<64;y+=8)
u8g.drawLine(47,y,49,y);

for(x=8;x<96;x+=8)
{
for(y=8;y<64;y+=8)
u8g.drawPixel(x,y);
}

u8g.drawStr(98,7,"MS/div");
u8g.drawStr(98,23,"V/div");
u8g.drawStr(98,30,"0.324");
u8g.drawStr(98,40,"Vpp");
u8g.setPrintPos( 98, 47);
u8g.print(Vpp);
u8g.drawStr(118,47,"V");
u8g.drawStr(98,55,"F(HZ)");
switch(Key)
{
case 1:
u8g.drawStr(98,14,"0.02");
u8g.setPrintPos( 98, 62);
u8g.print(Freq50);
break;
case 2:
u8g.drawStr(98,14,"0.05");
u8g.setPrintPos( 98, 62);
u8g.print(Freq
20);
break;
case 3:
u8g.drawStr(98,14," 0.1");
u8g.setPrintPos( 98, 62);
u8g.print(Freq10);
break;
case 4:
u8g.drawStr(98,14," 0.2");
u8g.setPrintPos( 98, 62);
u8g.print(Freq
5);
break;
case 5:
u8g.drawStr(98,14," 0.5");
u8g.setPrintPos( 98, 62);
u8g.print(Freq*2);
break;
case 6:
u8g.drawStr(98,14," 1");
u8g.setPrintPos( 98, 62);
u8g.print(Freq);
break;
case 7:
u8g.drawStr(98,14," 2");
u8g.setPrintPos( 98, 62);
u8g.print(Freq/2);
break;
case 8:
u8g.drawStr(98,14," 5");
u8g.setPrintPos( 98, 62);
u8g.print(Freq/5);
break;
case 9:
u8g.drawStr(98,14," 10");
u8g.setPrintPos( 98, 62);
u8g.print(Freq/10);
break;
default:break;
}
}

void Key_scan()
{
if(digitalRead(Key_add)==LOW)
{
while(digitalRead(Key_add)==LOW);
Key++;
if(Key==10)
Key=9;
delay(10);
}
if(digitalRead(Key_sub)==LOW)
{
while(digitalRead(Key_sub)==LOW);
Key--;
if(Key==0)
Key=1;
delay(10);
}
if(digitalRead(Key_hold)==LOW)
{
while(digitalRead(Key_hold)==LOW);
hold=~hold;
delay(10);
}
}

Welcome to the forum

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

Why don't you give us a hand, and tell us the nature of "the error"?

this is the error. only this is showing, nothing else but working fine as expected.

expected img
this is what I expected.

You may need to specifically set the font for the display.

u8g.setFont(u8g_font_5x7);
you men this??

Yes, I do not see any call to setFont() in the code you posted, although the lack of code tags is causing some of the code to be displayed incorrectly.

Then what I will do ?? I need suggestion.. I'm still trying to correct


and improve the code.

#include <U8glib.h>
//U8GLIB_ST7920_128X64_4X u8g(6, 5, 4);
U8GLIB_KS0108_128 u8g(2, 3, 4, 5, 6, 7, 8, 9, A3, A4, A5, A1, A2);
int Input = A0;
int Key_add = 0;
int Key_sub = 1;
int Key_hold = 10;
int x,y;
int i,i1,i2,V_min,V_max,V_mid,t,t0,t1,sta,Key=1,hold=0;
long Freq;
float Vpp;
int Y[96];
int Buffer[192];

void setup( )
{
pinMode(Key_add,INPUT);
digitalWrite(Key_add,HIGH);
pinMode(Key_sub,INPUT);
digitalWrite(Key_sub,HIGH);
pinMode(Key_hold,INPUT);
digitalWrite(Key_hold,HIGH);
ADMUX=0x60;
ADCSRA=0xe2;
do{
u8g.setFont(u8g_font_5x7);
}
while( u8g.nextPage() );
delay(2000);
analogReference(INTERNAL);
}

void loop( )
{
sample( );
Measure( );
Transform( );
Key_scan( );
draw();
if(hold==0)
{
u8g.firstPage( );
do
{
draw( );
}
while( u8g.nextPage( ));
}
}

void sample( )
{ for(i = 0;i < 192;i++)
{
Buffer[i] = ADCH;
switch(Key)
{
case 1:
break;
case 2:
delayMicroseconds(4);
break;
case 3:
delayMicroseconds(10);
break;
case 4:
delayMicroseconds(23);
break;
case 5:
delayMicroseconds(60);
break;
case 6:
delayMicroseconds(123);
break;
case 7:
delayMicroseconds(248);
break;
case 8:
delayMicroseconds(623);
break;
case 9:
delayMicroseconds(1247);
break;
default:break;
}
}
}

void Measure()
{
V_max=Buffer[0];
V_min=Buffer[0];
for(i=0;i<192;i++)
{
if(Buffer[i]>V_max)
V_max=Buffer[i];
if(Buffer[i]<V_min)
V_min=Buffer[i];
}
V_mid=(V_max+V_min)/2;
Vpp=(V_max-V_min)*5/255;
for(i=0;i<97;i++)
{
if(Buffer[i]<V_mid&&Buffer[i+1]>=V_mid)
{
i1=i;
break;
}
}
for(i=i1+1;i<98+i1;i++)
{
if(Buffer[i]<V_mid&&Buffer[i+1]>=V_mid)
{
i2=i;
break;
}
}
t=i2-i1;
if(t>0)
Freq=8000/t;
else
Freq=0;
}

void Transform( )
{
for(sta=0;sta<96;sta++)
{
if(Buffer[sta]<128&&Buffer[sta+2]>128)
break;
}
for(i = 0;i < 96;i++)
Y[i] = 63-(Buffer[i+sta]>>2);
}

void draw( )
{
for(x = 0;x < 95;x++)
u8g.drawLine(x,Y[x],x,Y[x+1]);

u8g.drawFrame(0,0,97,64);

u8g.drawLine(48,0,48,63);
u8g.drawLine(0,32,96,32);
for(x=0;x<96;x+=8)
u8g.drawLine(x,31,x,33);
for(y=0;y<64;y+=8)
u8g.drawLine(47,y,49,y);

for(x=8;x<96;x+=8)
{
for(y=8;y<64;y+=8)
u8g.drawPixel(x,y);
}

u8g.drawStr(98,7,"MS/div");
u8g.drawStr(98,23,"V/div");
u8g.drawStr(98,30,"0.324");
u8g.drawStr(98,40,"Vpp");
u8g.setPrintPos( 98, 47);
u8g.print(Vpp);
u8g.drawStr(118,47,"V");
u8g.drawStr(98,55,"F(HZ)");
switch(Key)
{
case 1:
u8g.drawStr(98,14,"0.02");
u8g.setPrintPos( 98, 62);
u8g.print(Freq50);
break;
case 2:
u8g.drawStr(98,14,"0.05");
u8g.setPrintPos( 98, 62);
u8g.print(Freq
20);
break;
case 3:
u8g.drawStr(98,14," 0.1");
u8g.setPrintPos( 98, 62);
u8g.print(Freq10);
break;
case 4:
u8g.drawStr(98,14," 0.2");
u8g.setPrintPos( 98, 62);
u8g.print(Freq
5);
break;
case 5:
u8g.drawStr(98,14," 0.5");
u8g.setPrintPos( 98, 62);
u8g.print(Freq*2);
break;
case 6:
u8g.drawStr(98,14," 1");
u8g.setPrintPos( 98, 62);
u8g.print(Freq);
break;
case 7:
u8g.drawStr(98,14," 2");
u8g.setPrintPos( 98, 62);
u8g.print(Freq/2);
break;
case 8:
u8g.drawStr(98,14," 5");
u8g.setPrintPos( 98, 62);
u8g.print(Freq/5);
break;
case 9:
u8g.drawStr(98,14," 10");
u8g.setPrintPos( 98, 62);
u8g.print(Freq/10);
break;
default:break;
}
}

void Key_scan()
{
if(digitalRead(Key_add)==LOW)
{
while(digitalRead(Key_add)==LOW);
Key++;
if(Key==10)
Key=9;
delay(10);
}
if(digitalRead(Key_sub)==LOW)
{
while(digitalRead(Key_sub)==LOW);
Key--;
if(Key==0)
Key=1;
delay(10);
}
if(digitalRead(Key_hold)==LOW)
{
while(digitalRead(Key_hold)==LOW);
hold=~hold;
delay(10);
}
}
this is the compilation error code.

now tell me where I will add set font ?? and how ?? I'm not the expert programmer.. :expressionless:

?

Please use code tags when posting code.

setFont would normally be done in the setup function.

Perhaps your code could look like this, if you tried a bit harder. All I did was laboriously cut and paste your code into the IDE, then press ctrl-t, then press shift-ctrl-c, then switch to this message box and press ctrl-v. You could do that much in future, please (even if you won't read the help info you've been pointed to):

#include <U8glib.h>
//U8GLIB_ST7920_128X64_4X u8g(6, 5, 4);
U8GLIB_KS0108_128 u8g(2, 3, 4, 5, 6, 7, 8, 9, A3, A4, A5, A1, A2);
int Input = A0;
int Key_add = 0;
int Key_sub = 1;
int Key_hold = 10;
int x, y;
int i, i1, i2, V_min, V_max, V_mid, t, t0, t1, sta, Key = 1, hold = 0;
long Freq;
float Vpp;
int Y[96];
int Buffer[192];

void setup( )
{
  pinMode(Key_add, INPUT);
  digitalWrite(Key_add, HIGH);
  pinMode(Key_sub, INPUT);
  digitalWrite(Key_sub, HIGH);
  pinMode(Key_hold, INPUT);
  digitalWrite(Key_hold, HIGH);
  ADMUX = 0x60;
  ADCSRA = 0xe2;
  do {
    u8g.setFont(u8g_font_5x7);
  }
  while ( u8g.nextPage() );
  delay(2000);
  analogReference(INTERNAL);
}

void loop( )
{
  sample( );
  Measure( );
  Transform( );
  Key_scan( );
  draw();
  if (hold == 0)
  {
    u8g.firstPage( );
    do
    {
      draw( );
    }
    while ( u8g.nextPage( ));
  }
}

void sample( )
{ for (i = 0; i < 192; i++)
  {
    Buffer[i] = ADCH;
    switch (Key)
    {
      case 1:
        break;
      case 2:
        delayMicroseconds(4);
        break;
      case 3:
        delayMicroseconds(10);
        break;
      case 4:
        delayMicroseconds(23);
        break;
      case 5:
        delayMicroseconds(60);
        break;
      case 6:
        delayMicroseconds(123);
        break;
      case 7:
        delayMicroseconds(248);
        break;
      case 8:
        delayMicroseconds(623);
        break;
      case 9:
        delayMicroseconds(1247);
        break;
      default: break;
    }
  }
}

void Measure()
{
  V_max = Buffer[0];
  V_min = Buffer[0];
  for (i = 0; i < 192; i++)
  {
    if (Buffer[i] > V_max)
      V_max = Buffer[i];
    if (Buffer[i] < V_min)
      V_min = Buffer[i];
  }
  V_mid = (V_max + V_min) / 2;
  Vpp = (V_max - V_min) * 5 / 255;
  for (i = 0; i < 97; i++)
  {
    if (Buffer[i] < V_mid && Buffer[i + 1] >= V_mid)
    {
      i1 = i;
      break;
    }
  }
  for (i = i1 + 1; i < 98 + i1; i++)
  {
    if (Buffer[i] < V_mid && Buffer[i + 1] >= V_mid)
    {
      i2 = i;
      break;
    }
  }
  t = i2 - i1;
  if (t > 0)
    Freq = 8000 / t;
  else
    Freq = 0;
}

void Transform( )
{
  for (sta = 0; sta < 96; sta++)
  {
    if (Buffer[sta] < 128 && Buffer[sta + 2] > 128)
      break;
  }
  for (i = 0; i < 96; i++)
    Y[i] = 63 - (Buffer[i + sta] >> 2);
}

void draw( )
{
  for (x = 0; x < 95; x++)
    u8g.drawLine(x, Y[x], x, Y[x + 1]);

  u8g.drawFrame(0, 0, 97, 64);

  u8g.drawLine(48, 0, 48, 63);
  u8g.drawLine(0, 32, 96, 32);
  for (x = 0; x < 96; x += 8)
    u8g.drawLine(x, 31, x, 33);
  for (y = 0; y < 64; y += 8)
    u8g.drawLine(47, y, 49, y);

  for (x = 8; x < 96; x += 8)
  {
    for (y = 8; y < 64; y += 8)
      u8g.drawPixel(x, y);
  }

  u8g.drawStr(98, 7, "MS/div");
  u8g.drawStr(98, 23, "V/div");
  u8g.drawStr(98, 30, "0.324");
  u8g.drawStr(98, 40, "Vpp");
  u8g.setPrintPos( 98, 47);
  u8g.print(Vpp);
  u8g.drawStr(118, 47, "V");
  u8g.drawStr(98, 55, "F(HZ)");
  switch (Key)
  {
    case 1:
      u8g.drawStr(98, 14, "0.02");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq50);
      break;
    case 2:
      u8g.drawStr(98, 14, "0.05");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq20);
      break;
    case 3:
      u8g.drawStr(98, 14, " 0.1");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq10);
      break;
    case 4:
      u8g.drawStr(98, 14, " 0.2");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq5);
      break;
    case 5:
      u8g.drawStr(98, 14, " 0.5");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq * 2);
      break;
    case 6:
      u8g.drawStr(98, 14, " 1");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq);
      break;
    case 7:
      u8g.drawStr(98, 14, " 2");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq / 2);
      break;
    case 8:
      u8g.drawStr(98, 14, " 5");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq / 5);
      break;
    case 9:
      u8g.drawStr(98, 14, " 10");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq / 10);
      break;
    default: break;
  }
}

void Key_scan()
{
  if (digitalRead(Key_add) == LOW)
  {
    while (digitalRead(Key_add) == LOW);
    Key++;
    if (Key == 10)
      Key = 9;
    delay(10);
  }
  if (digitalRead(Key_sub) == LOW)
  {
    while (digitalRead(Key_sub) == LOW);
    Key--;
    if (Key == 0)
      Key = 1;
    delay(10);
  }
  if (digitalRead(Key_hold) == LOW)
  {
    while (digitalRead(Key_hold) == LOW);
    hold = ~hold;
    delay(10);
  }
}

:face_exhaling: :disappointed:
ya code exactly this but error for compilation, I mentioned earlier I'm not an expert programmer.
And ya I tried a little harder. But alas I failed :disappointed: :face_exhaling:

What error?
It doesn't matter how good or bad a programmer you are, it's just common sense to show us what we can't see.

There's a button to copy the error from the IDE. Paste it into a response, please.
Most of us can't compile, to generate the error, because we don't have your include files, so you have to give us the help.
For example, here's what I get:
Arduino: 1.8.19 (Windows 8.1), Board: "Arduino Nano, ATmega328P"

sketch_mar18a:1:10: fatal error: U8glib.h: No such file or directory

#include <U8glib.h>

      ^~~~~~~~~~

compilation terminated.

exit status 1

U8glib.h: No such file or directory

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

#include <U8glib.h>
//U8GLIB_ST7920_128X64_4X u8g(6, 5, 4);
U8GLIB_KS0108_128 u8g(2, 3, 4, 5, 6, 7, 8, 9, A3, A4, A5, A1, A2);
int Input = A0;
int Key_add = 0;
int Key_sub = 1;
int Key_hold = 10;
int x, y;
int i, i1, i2, V_min, V_max, V_mid, t, t0, t1, sta, Key = 1, hold = 0;
long Freq;
float Vpp;
int Y[96];
int Buffer[192];

void setup( )
{
  pinMode(Key_add, INPUT);
  digitalWrite(Key_add, HIGH);
  pinMode(Key_sub, INPUT);
  digitalWrite(Key_sub, HIGH);
  pinMode(Key_hold, INPUT);
  digitalWrite(Key_hold, HIGH);
  ADMUX = 0x60;
  ADCSRA = 0xe2;
  do {
    u8g.setFont(u8g_font_5x7);
  }
  while ( u8g.nextPage() );
  delay(2000);
  analogReference(INTERNAL);
}

void loop( )
{
  sample( );
  Measure( );
  Transform( );
  Key_scan( );
  draw();
  if (hold == 0)
  {
    u8g.firstPage( );
    do
    {
      draw( );
    }
    while ( u8g.nextPage( ));
  }
}

void sample( )
{ for (i = 0; i < 192; i++)
  {
    Buffer[i] = ADCH;
    switch (Key)
    {
      case 1:
        break;
      case 2:
        delayMicroseconds(4);
        break;
      case 3:
        delayMicroseconds(10);
        break;
      case 4:
        delayMicroseconds(23);
        break;
      case 5:
        delayMicroseconds(60);
        break;
      case 6:
        delayMicroseconds(123);
        break;
      case 7:
        delayMicroseconds(248);
        break;
      case 8:
        delayMicroseconds(623);
        break;
      case 9:
        delayMicroseconds(1247);
        break;
      default: break;
    }
  }
}

void Measure()
{
  V_max = Buffer[0];
  V_min = Buffer[0];
  for (i = 0; i < 192; i++)
  {
    if (Buffer[i] > V_max)
      V_max = Buffer[i];
    if (Buffer[i] < V_min)
      V_min = Buffer[i];
  }
  V_mid = (V_max + V_min) / 2;
  Vpp = (V_max - V_min) * 5 / 255;
  for (i = 0; i < 97; i++)
  {
    if (Buffer[i] < V_mid && Buffer[i + 1] >= V_mid)
    {
      i1 = i;
      break;
    }
  }
  for (i = i1 + 1; i < 98 + i1; i++)
  {
    if (Buffer[i] < V_mid && Buffer[i + 1] >= V_mid)
    {
      i2 = i;
      break;
    }
  }
  t = i2 - i1;
  if (t > 0)
    Freq = 8000 / t;
  else
    Freq = 0;
}

void Transform( )
{
  for (sta = 0; sta < 96; sta++)
  {
    if (Buffer[sta] < 128 && Buffer[sta + 2] > 128)
      break;
  }
  for (i = 0; i < 96; i++)
    Y[i] = 63 - (Buffer[i + sta] >> 2);
}

void draw( )
{
  for (x = 0; x < 95; x++)
    u8g.drawLine(x, Y[x], x, Y[x + 1]);

  u8g.drawFrame(0, 0, 97, 64);

  u8g.drawLine(48, 0, 48, 63);
  u8g.drawLine(0, 32, 96, 32);
  for (x = 0; x < 96; x += 8)
    u8g.drawLine(x, 31, x, 33);
  for (y = 0; y < 64; y += 8)
    u8g.drawLine(47, y, 49, y);

  for (x = 8; x < 96; x += 8)
  {
    for (y = 8; y < 64; y += 8)
      u8g.drawPixel(x, y);
  }

  u8g.drawStr(98, 7, "MS/div");
  u8g.drawStr(98, 23, "V/div");
  u8g.drawStr(98, 30, "0.324");
  u8g.drawStr(98, 40, "Vpp");
  u8g.setPrintPos( 98, 47);
  u8g.print(Vpp);
  u8g.drawStr(118, 47, "V");
  u8g.drawStr(98, 55, "F(HZ)");
  switch (Key)
  {
    case 1:
      u8g.drawStr(98, 14, "0.02");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq50);
      break;
    case 2:
      u8g.drawStr(98, 14, "0.05");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq20);
      break;
    case 3:
      u8g.drawStr(98, 14, " 0.1");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq10);
      break;
    case 4:
      u8g.drawStr(98, 14, " 0.2");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq5);
      break;
    case 5:
      u8g.drawStr(98, 14, " 0.5");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq * 2);
      break;
    case 6:
      u8g.drawStr(98, 14, " 1");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq);
      break;
    case 7:
      u8g.drawStr(98, 14, " 2");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq / 2);
      break;
    case 8:
      u8g.drawStr(98, 14, " 5");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq / 5);
      break;
    case 9:
      u8g.drawStr(98, 14, " 10");
      u8g.setPrintPos( 98, 62);
      u8g.print(Freq / 10);
      break;
    default: break;
  }
}

void Key_scan()
{
  if (digitalRead(Key_add) == LOW)
  {
    while (digitalRead(Key_add) == LOW);
    Key++;
    if (Key == 10)
      Key = 9;
    delay(10);
  }
  if (digitalRead(Key_sub) == LOW)
  {
    while (digitalRead(Key_sub) == LOW);
    Key--;
    if (Key == 0)
      Key = 1;
    delay(10);
  }
  if (digitalRead(Key_hold) == LOW)
  {
    while (digitalRead(Key_hold) == LOW);
    hold = ~hold;
    delay(10);
  }
}

sorry this is the code and this is error messages
Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Uno"

C:\Users\PROJEC~1\AppData\Local\Temp\ccnkmzwi.ltrans0.ltrans.o: In function `u8g_SetFont':

C:\Users\ProjectCosmicArc\OneDrive\Documents\Arduino\libraries\U8glib_Arduino-master\src\clib/u8g_font.c:1431: undefined reference to `u8g_font_5x7'

C:\Users\ProjectCosmicArc\OneDrive\Documents\Arduino\libraries\U8glib_Arduino-master\src\clib/u8g_font.c:1431: undefined reference to `u8g_font_5x7'

C:\Users\ProjectCosmicArc\OneDrive\Documents\Arduino\libraries\U8glib_Arduino-master\src\clib/u8g_font.c:1429: undefined reference to `u8g_font_5x7'

C:\Users\ProjectCosmicArc\OneDrive\Documents\Arduino\libraries\U8glib_Arduino-master\src\clib/u8g_font.c:1429: undefined reference to `u8g_font_5x7'

C:\Users\PROJEC~1\AppData\Local\Temp\ccnkmzwi.ltrans0.ltrans.o: In function `u8g_font_get_byte':

C:\Users\ProjectCosmicArc\OneDrive\Documents\Arduino\libraries\U8glib_Arduino-master\src\clib/u8g_font.c:91: undefined reference to `u8g_font_5x7'

C:\Users\PROJEC~1\AppData\Local\Temp\ccnkmzwi.ltrans0.ltrans.o:C:\Users\ProjectCosmicArc\OneDrive\Documents\Arduino\libraries\U8glib_Arduino-master\src\clib/u8g_font.c:91: more undefined references to `u8g_font_5x7' follow

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board Arduino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Hopefully, someone using those libraries will be able to assist you.

Not sure why you are getting the error message, u8g_font_5x7 is one of the default fonts from the U8glib library. The problem may be related to the use of OneDrive.

Do not use the do...while(u8g.nextPage()) without preceding it with u8g.firstPage(). For just setting the font that is not needed, since nothing is being sent to the display.

void setup( )
{
  pinMode(Key_add, INPUT);
  digitalWrite(Key_add, HIGH);
  pinMode(Key_sub, INPUT);
  digitalWrite(Key_sub, HIGH);
  pinMode(Key_hold, INPUT);
  digitalWrite(Key_hold, HIGH);
  ADMUX = 0x60;
  ADCSRA = 0xe2;
  u8g.setFont(u8g_font_5x7);
  delay(2000);
  analogReference(INTERNAL);
}

I did it as you said but again same problem :worried: :face_exhaling:error compiling for arduino uno or nano ..is my arduino compiler got partially error during windows update because a month ago it was compiling like a charm , a week before it compiled correctly but now just got error what shall I do?? please help me... :disappointed: I already un installed and installed arduino ide from microsoft store and arduino forum...