Two or more data types in declaration of 'setup' error message

hi I'm having trouble with the two or more data types in declaration of 'setup' err and cant figure out what wrong in trying to make a decorative terminal with different modes I got to a certain point in it and I decided do do a check and this came up

here is my code

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows
int led = LED_BUILTIN;
int 
void setup(){
    lcd.init(); // initialize the lcd
  lcd.clear();
  lcd.backlight();
  pinMode(1, INPUT);
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(4, INPUT);
  pinMode(5, INPUT);
  }
void loop(){
  int k;
  int l;
lcd.setCursor(0,0);
lcd.print("engaging...");
  for (int i = 0; i <= 100; i++){
    lcd.setCursor(0,1);
    lcd.print(i);
    delay(100);
    lcd.setCursor(3,1);
    lcd.print("%");
    }
    delay(1000);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("welcome");
    lcd.setCursor(0,1);
    lcd.print("blip terminal");
    delay(5000);
    int l = int readbutton(1,0,0,0,0)
    int k = int readbutton(0,1,0,0,0)

        }
  }

  int readbutton(int q,int w,int e,int r,int t){
    int buttonState1;
    int buttonState2;
    int buttonState3;
    int buttonState4;
    int buttonState5;
    if(q = 1){
      buttonState1 = digitalRead(1);
      
      return buttonState1;
      }
    if(w = 1){
      buttonState2 = digitalRead(2);
       
      return buttonState2;
      }
    if(e = 1){
      buttonState3 = digitalRead(3);
       
      return buttonState3;
      }
    if(r = 1){
      buttonState4 = digitalRead(4);
       
      return buttonState4;
    }
    if(t = 1){
      buttonState5 = digitalRead(5);
       
      return buttonState5;
      }
    
    
    }

The error will declare what is duplicated. Copy/paste the error here to help find it.

Do you have a library that uses lcd.begin() versus lcd.init()?

What is that int doing there on the line before void setup()?

And many other places …

Three errors in one line:

  • if it is a function, the int before the name is superfluous
  • no semicolon at the end of the line
  • the function call is useless because the result is assigned to a local variable, which is destroyed when the block exits in the next line of code.

...and many many other errors in other lines
@blipcodes
I would advise you to read the C language tutorial first - it will save you a lot of time

yah I'm a beginner thx

idk my code can be weird at times

my full err message

Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno"





















termanal:3:16: error: two or more data types in declaration of 'setup'

 int led = LED_BUILTIN;

                ^

termanal:5:12: error: two or more data types in declaration of 'setup'

 void setup(){

            ^

C:\Users\User\OneDrive\Documents\Arduino\termanal\termanal.ino: In function 'void loop()':

termanal:34:9: error: redeclaration of 'int l'

     int l = int readbutton(1,0,0,0,0)

         ^

C:\Users\User\OneDrive\Documents\Arduino\termanal\termanal.ino:17:7: note: 'int l' previously declared here

   int l;

       ^

termanal:34:13: error: expected primary-expression before 'int'

     int l = int readbutton(1,0,0,0,0)

             ^~~

C:\Users\User\OneDrive\Documents\Arduino\termanal\termanal.ino: At global scope:

termanal:38:3: error: expected declaration before '}' token

   }

   ^

exit status 1

two or more data types in declaration of 'setup'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.