Iam getting this error - too few arguments to function 'int

Hello,
I am getting this error: too few arguments to function 'int grazinimas1(int). I think that the function can't take level, because it's not actual int.. So question: how to make level(in my situation) be like int or something like that?

int reader1 = analogRead(pot1);

int level = map(reader1, 0, 1020, 0, 100);
grazinimas1(level);

int grazinimas1(int tas)
{  
   
    static int pasklevel = tas;
     
return pasklevel;    
}

It makes no sense to make pasklevel static, because you change the value every time the function is called.

We need to see ALL of your code.

The value from an analogRead() call is a reading, not a reader.

I call it reader, just because I can't imagine any word :confused:.

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int pot1 = A0;
int pot2 = A1;
int d7 = 7;
int d8 = 8;
int a = 0;
int pasklevel;
int paskleve;

void setup() 
{
 
  lcd.begin(16, 2);
  Serial.begin(9600);
  int reader1 = analogRead(pot1); // I am using reader1 to map level in other part of code
  int reader2 = analogRead(pot2); 
  digitalWrite(d7, HIGH);
  digitalWrite(d8, HIGH);

}
void loop()
{
 int reader1 = analogRead(pot1);
 int reader2 = analogRead(pot2);
 // Serial.println(reader1);
 int level = map(reader1, 0, 1020, 0, 100);
 int leve = map(reader2, 0, 989, 0, 100);
 grazinimas1(level);

}

int grazinimas1(int tas)
{  
   
    int pasklevel = tas;
     
return pasklevel;    
}

And I am getting only one error message: "too few arguments to function 'int grazinimas1(int)".
everything is declared everything just fine.

That's a part of my code but enough for you to understand what's wrong. The problem is that: that function grazinimas1 can't take level as int. So I am asking you is there any posibility to make level as actual int? Thank you for your response, I am just a begginer so that's why sometimes questions sounds like 12 years old kid :frowning:

That's a part of my code but enough for you to

get this "error" when compiling:

Binary sketch size: 6,460 bytes (of a 28,672 byte maximum)

So, it does NOT illustrate the problem you claim to have.

I am getting only one error message: "too few arguments to function 'int grazinimas1(int)".
everything is declared, everything just working fine.

I get only one error message: "too few arguments to function 'int grazinimas1(int)".
everything is declared, everything just working fine.

With the exact code you posted? The code that compiles fine for me? Or is it some other code?

BornToBeDumb:
That's a part of my code but enough for you to understand what's wrong.

No. You really must post all your code. In case you didn't catch on, the code you posted won't generate errors (although it's complete nonsense!).

Sorry for wasting your time, but i thought that it would be enough now here is my full code its over 400 lines if you compile it it shows that error.

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int pot1 = A0;
int pot2 = A1;
int d7 = 7;
int d8 = 8;
int a = 0;
int pasklevel;
int paskleve;

void setup() 
{
  lcd.begin(16, 2);
  Serial.begin(9600);
  int reader1 = analogRead(pot1);
  int reader2 = analogRead(pot2); 
  calibravimas();
  digitalWrite(d7, HIGH);
  digitalWrite(d8, HIGH);
  int level = pasklevel;
  int leve =  paskleve;
  
}

void loop() 
{
  
  int reader1 = analogRead(pot1);
  int reader2 = analogRead(pot2);
  Serial.println(reader1);
  int level = map(reader1, 0, 1020, 0, 100);
  int leve = map(reader2, 0, 989, 0, 100);
  grazinimas1(level);

    
  
if(level != pasklevel)
{   
    verte1();
    lcd.setCursor(0, 0);
    lcd.print("                   ");
    garsas();
    grazinimas1();
    Serial.println("Pasklevel= ");
    Serial.print(pasklevel);
    while(1)
    {
      lcd.setCursor(0 , 0);
      verte1();
      
      if(leve != paskleve)
     {
        break;
     }
    else
    {
    } 
 }  
    
}


   if(leve != paskleve)
    {
      verte2();
      lcd.setCursor(0, 0);
      lcd.print("                   ");
      bass();
      while(1)
      {
        verte2();
        int reader = analogRead(pot1);
        int level = map(reader, 0, 1020, 0, 100);
          if(level != pasklevel)
          {
            break;
            return;
          }
    }
  } 
    else
  {
    lcd.setCursor(0, 0);
    lcd.print("Veikia ELSE!!!");
  }
}


void pote()
{
  lcd.setCursor(0, 0);
  lcd.print("potenciometras:");
  delay(900);
}
void verte1()
{
  
  int reader = analogRead(pot1);
  //Serial.println(reader);
  int level = map(reader, 0, 1020, 0, 100);
  if(level < 99)
  {
    lcd.setCursor(0, 1);
    delay(1);
    lcd.print(level);
  } 
  if(level < 100)
  {
     lcd.setCursor(2, 1);
     lcd.print(" ");
  }
  if(level < 10)
  {
     lcd.setCursor(1, 1);
     lcd.print(" ");
  }
   else
  {
    lcd.setCursor(0, 1);
    delay(1);
    lcd.print(level);
  }
  
}

void verte2()
{

  

  int reader2 = analogRead(pot2);
  //Serial.println(reader2);
  delay(0);
  int leve = map(reader2, 0, 989, 0, 100);
  if(leve < 99)
  {
    lcd.setCursor(0, 1);
    delay(100);
    lcd.print(leve);
  } 
  if(leve < 100)
  {
     lcd.setCursor(2, 1);
     lcd.print(" ");
  }
  if(leve < 10)
  {
     lcd.setCursor(1, 1);
     lcd.print(" ");
  }
   else
  {
    lcd.setCursor(0, 1);
    delay(100);
    lcd.print(leve);
  }
  
}


void rib1()
{
  lcd.setCursor(6, 1);
  lcd.print("riamiau");
  delay(500);
  lcd.setCursor(6, 1);
  lcd.print("       ");
  delay(500);
}

void rib2()
{
  lcd.setCursor(6, 1);
  lcd.print("mazink!!!");
  delay(500);
  lcd.setCursor(6, 1);
  lcd.print("         ");
  delay(500);
}
void rib3()
{
  lcd.setCursor(6, 1);
  lcd.print("MASSIVE");
  delay(500);
  lcd.setCursor(6, 1);
  lcd.print("       ");
  delay(500);
}

void jeigu()
{
  int reader = analogRead(pot1);
  //Serial.println(reader);
  delay(0);
  int level = map(reader, 0, 989, 0, 100);
  if(level > 80)
  {
    rib1(); 
  }
  else if(level > 90)
  {
    rib2(); 
  }
  else if(level > 98)
  {
    rib3(); 
  } 

}
void calibravimas()
{
  lcd.blink();
  lcd.setCursor(0, 0);
  lcd.print("L");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("b");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("s");
  delay(2000);
  lcd.setCursor(0, 1);
  lcd.print("S");
  delay(100);
  lcd.print("i");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("n");
  delay(100);
  lcd.print("d");
  delay(100);
  lcd.print("i");
  delay(100);
  lcd.print("e");
  delay(100);
  lcd.print("n");
  delay(100);
  lcd.print(" ");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("s");
  delay(100);
  lcd.print(" ");
  delay(100);
  lcd.print("t");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("u");
  delay(1000);
  lcd.setCursor(0, 1);
  lcd.clear();
  lcd.print("p");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("r");
  delay(100);
  lcd.print("o");
  delay(100);
  lcd.print("d");
  delay(100);
  lcd.print("y");
  delay(100);
  lcd.print("s");
  delay(100);
  lcd.print("i");
  delay(100);
  lcd.print("u");
  delay(2000);
  lcd.clear();
  
  
  //vo
  lcd.setCursor(0, 0);
  lcd.print("G");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("r");
  delay(100);
  lcd.print("s");
  delay(100);
  lcd.print("o");
  delay(100);
  lcd.print(" ");
  delay(100);
  lcd.print("s");
  delay(100);
  lcd.print("t");
  delay(100);
  lcd.print("i");
  delay(100);
  lcd.print("p");
  delay(100);
  lcd.print("r");
  delay(100);
  lcd.print("u");
  delay(100);
  lcd.print("m");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print(" ");
  delay(100);
  lcd.setCursor(0, 1);
  lcd.print("p");
  delay(100);
  lcd.print("r");
  delay(100);
  lcd.print("o");
  delay(100);
  lcd.print("c");
  delay(100);
  lcd.print("e");
  delay(100);
  lcd.print("n");
  delay(100);
  lcd.print("t");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("i");
  delay(100);
  lcd.print("s");
  delay(2500);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("T");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("i");
  delay(100);
  lcd.print("g");
  delay(100);
  lcd.print("i");
  delay(1000);
  lcd.clear();
}

void garsas()
{
  lcd.setCursor(0, 0);
  lcd.print("G");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("r");
  delay(100);
  lcd.print("s");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("s");
  delay(100);
  lcd.print("(");
  delay(100);
  lcd.print("%");
  delay(100);
  lcd.print(")");
  delay(100);
  lcd.print(":");
  delay(100);
  lcd.setCursor(4, 1);
  lcd.print("%"); 
}

void bass()
{
  lcd.setCursor(0, 0);
  lcd.print("B");
  delay(100);
  lcd.print("a");
  delay(100);
  lcd.print("s");
  delay(100);  
  lcd.print("s");
  lcd.setCursor(4, 1);
  lcd.print("%");
}

int timer(int time)
{
   for(int time = 0; time < 1000; time++) 
   {
      digitalWrite(10, HIGH);
      delay(time); 
   }
}

void itvirtinimas1()
{
   lcd.setCursor(0, 1);
   lcd.print("Garsas");    
}

void itvirtinimas2()
{
   lcd.setCursor(0, 1);
   lcd.print("Bass");    
}
void nieko()
{
   lcd.setCursor(0, 0); 
   lcd.print("             ");
   lcd.setCursor(0, 0); 
   lcd.print("NIEKO"); 
}

int grazinimas1(int tas)
{  
   
    static int pasklevel = tas;
     
return pasklevel;    
}

Which of the five different variables named level in your program is causing the problem do you think ?

      if(level != pasklevel)
      {
        break;
        return;
      }

Oops

And in 'loop()' you make the call

    grazinimas1();

but the function is declared to take an argument!

Again, what do you hope to achieve by making pasklevel static here? Also, can you see that the function does nothing but return the value that is passed to it?

int grazinimas1(int tas)
{  
    static int pasklevel = tas;    
    return pasklevel;   
}