problem using void

im just playing around with my project
im trying to build a smart home and right now working on a code for auto on/off of the room lights
im not that good with the language so im pretty much a newbie… but i just cant find the error in my code please help me

int val=0;
int val2=0;
int InputPin=A0;
int InputPin2=A2;
int OutputPin=0;
int checkinc=0;


void setup() {
 Serial.begin(9600);
 digitalWrite(OutputPin, LOW);
}

void loop() {
  // put your main code here, to run repeatedly:
  val = analogRead(InputPin);        // read the input pin 0 to 1023
  Serial.println("valume ONE is:");
  Serial.println(val);
  if(val>500 && val2<500){
  checkin();
  }
  val2 = analogRead(InputPin2);        // read the input pin 0 to 1023
  Serial.println("valume TWO is:");
  Serial.println(val2);
  if(val2>500 && val<500){
  checkout();  
  
}
void checkin();{
  val2 = analogRead(InputPin2);        // read the input pin 0 to 1023
  Serial.println("valume TWO is:");
  Serial.println(val2);
  if(val2>500 && val>500){
    checkinc=checkinc+1;
    if(checkinc>=1){
    digitalWrite(OutputPin, HIGH);
  }
  }
}
void checkout(){
  val = analogRead(InputPin);        // read the input pin 0 to 1023
  Serial.println("valume ONE is:");
  Serial.println(val); 
  if(val2>500 && val>500){
    checkinc=checkinc-1;
    if(checkinc<=0){
      digitalWrite(OutputPin, LOW);
      if(checkinc<0){
      checkinc=0;
    }
    
  }
}

and thats the error im getting:

Arduino: 1.6.7 (Windows 7), Board: "Arduino Nano, ATmega328"

WARNING: Category '' in library EEPROM is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library SPI is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library SoftwareSerial is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library Wire is not valid. Setting to 'Uncategorized'
Warning: platform.txt from core 'Arduino AVR Boards' contains deprecated recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}", automatically converted to recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}". Consider upgrading this core.
C:\Users\Yoad\Documents\Arduino\RF_CHECK\RF_CHECK.ino: In function 'void loop()':

RF_CHECK:22: error: 'checkin' was not declared in this scope

   checkin();

           ^

RF_CHECK:30: error: 'checkout' was not declared in this scope

   checkout();  

            ^

RF_CHECK:39: error: assignment of function 'void checkin()'

     checkin=checkin+1;

            ^

RF_CHECK:39: error: cannot convert 'void (*)()' to 'void()' in assignment

RF_CHECK:40: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]

     if(checkin>=1){

                 ^

RF_CHECK:45: error: a function-definition is not allowed here before '{' token

 void checkout(){

                ^

RF_CHECK:58: error: expected '}' at end of input

 }

 ^

exit status 1
'checkin' was not declared in this scope

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

i dont know whats wrong i looked at like 1000000 other codes that used void (X) in the same way…

void checkin();{

remove the semicolon - there's no semicolon in a function declaration.

See what errors you get after that and post them.

It also looks like that code is not the code that produced those errors. The compiler error output mentions a lot of places where math was performed with "checkin" and it rightly complained, because checkin is a function - but in your code, I see you've changed all those to checkinc... so can you post latest code and compiler output too?

it was left there from the 1000 changes ive made trying to make this code run.. my mistake. and thats the code im using right now (the one from the begining)

but now thats the error:

Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Nano, ATmega328"

rf_check.ino: In function 'void loop()':
rf_check:33: error: a function-definition is not allowed here before '{' token
rf_check:57: error: expected '}' at end of input
a function-definition is not allowed here before '{' token

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
  if(val2>500 && val<500){
  checkout();  
  
}

Needs more }

AWOL:

  if(val2>500 && val<500){

checkout(); 
 
}



Needs more }

yea i noticed that i was missing a few and add them yet that not the real problem here:/ (i think…)

yet that not the real problem here:/ (i think..)

You think incorrectly.

Post your code.

Ctrl+T to autoformat code in the IDE - this makes problems with mismatched braces much easier to see.

AWOL:
You think incorrectly.

Post your code.

int val=0;
int val2=0;
int InputPin=A0;
int InputPin2=A2;
int OutputPin=0;
int checkinc=0;


void setup() {
 Serial.begin(9600);
 digitalWrite(OutputPin, LOW);
}

void loop(){
  // put your main code here, to run repeatedly:
  digitalWrite(OutputPin, HIGH);    // sets the output pin initially to LOW
  val = analogRead(InputPin);        // read the input pin 0 to 1023
  Serial.println("valume ONE is:");
  Serial.println(val);
  if(val>500 && val2<500){
  checkin();
  }
   digitalWrite(OutputPin, HIGH);    // sets the output pin initially to LOW
  val2 = analogRead(InputPin2);        // read the input pin 0 to 1023
  Serial.println("valume TWO is:");
  Serial.println(val2);
  if(val2>500 && val<500){
  checkout();  }


void checkin(){
  val2 = analogRead(InputPin2);        // read the input pin 0 to 1023
  Serial.println("valume TWO is:");
  Serial.println(val2);
  if(val2>500 && val>500){
    checkinc=checkinc+1;
    if(checkinc>=1){
    digitalWrite(OutputPin, HIGH);
  }
  }
}
void checkout(){
  val = analogRead(InputPin);        // read the input pin 0 to 1023
  Serial.println("valume ONE is:");
  Serial.println(val); 
  if(val2>500 && val>500){
    checkinc=checkinc-1;
  }
    if(checkinc<=0){
      digitalWrite(OutputPin, LOW);
    }
      if(checkinc<0){
      checkinc=0;
    }
    
}
}

See reply #3

AWOL: See reply #3

i got enough i checked twice every { has a } i dont think ive missed anything in there.. but still the main problem is in the voids idk whats wrong :(

Put every { on a line by itself. Put every } on a line by itself. Get back to us when every { has a matching }

i got enough i checked twice

I didn't need to check that many times

Each opening brace does have a closing one, I think - but they're totally not in the right place.

Find the matching brace to the one opening loop() function definition...

It is not valid C to put a function definition inside another function - but that's what you've got due to misplaced }.