i have no idea whats wrong with IF loops!!!

hi,here is the code i used and i have no idea whats wrong with it!

float units;
int sen;
int MIN;
int MAX;

void setup (){

***************************************************************************************
if (units >1200) {


if (sen>0 && sen<12){
  MIN=34;
  MAX=35.4;
  }
else if (sen>12 && sen<24){
  MIN=34;
  MAX=35.4;
  }
else if (sen>24 && sen<48){
  MIN=34;
  MAX=35;
  }
else if (sen>48 && sen<96){
  MIN=34;
  MAX=35;
  }
else if (sen>96 && sen<336){
  MIN=33;
  MAX=34;
  }
else if (sen>336 && sen<504){
  MIN=32.2;
  MAX=34;
  }
else if (sen>504 && sen<672){
  MIN=31.5;
  MAX=33.5;
  }
  }
***************************************************************************************
else if (units >1200 && units <1500) {


if (sen>0 && sen<12){
  MIN=33.9;
  MAX=34.4;
  }
else if (sen>12 && sen<24){
  MIN=33.3;
  MAX=34.3;
  }
else if (sen>24 && sen<48){
  MIN=33;
  MAX=34.2;
  }
else if (sen>48 && sen<96){
  MIN=33;
  MAX=34;
  }
else if (sen96 && sen<336){
  MIN=33;
  MAX=34;
  }
else if (sen>336 && sen<504){
  MIN=32.2;
  MAX=34;
  }
else if (sen>504 && sen<672){
  MIN=31.5;
  MAX=33.5;
  }
  }
***************************************************************************************
else if (units >1500 && units <2500) {


if (sen>0 && sen<12){
  MIN=32.8;
  MAX=33.8;
  }
else if (sen>12 && sen<24){
  MIN=31.8;
  MAX=33.8;
  }
else if (sen>24 && sen<48){
  MIN=31.5;
  MAX=33.5;
  }
else if (sen>48 && sen<96){
  MIN=31.2;
  MAX=33.3;
  }
else if (sen96 && sen<336){
  MIN=31;
  MAX=33;
  }
else if (sen>336 && sen<504){
  MIN=30.7;
  MAX=32.8;
  }
else if (sen>504 && sen<672){
  MIN=30;
  MAX=32.7;
  }
  }
***************************************************************************************
else if (units >2500) {


if (sen>0 && sen<12){
  MIN=32;
  MAX=33.8;
  }
else if (sen>12 && sen<24){
  MIN=31;
  MAX=33.7;
  }
else if (sen>24 && sen<48){
  MIN=30.5;
  MAX=33.3;
  }
else if (sen>48 && sen<96){
  MIN=30.5;
  MAX=33;
  }
}
}

also error code has too many characters (more than post limit)
so I will post that later if needed!

Where is:

void loop()
{
}

There is no such thing as an if loops

int MIN;
int MAX;
. . .
MAX=35.4 // How does these work for you?
. . .
MIN=32.2;

Every } needs a friend {

When using the reply button after the last post in your thread, you can attach files to a post. Save the errors to a file and attach the file to a reply.

If you switch off 'verbose output during compilation' in file -> preferences, the output will probably be sufficiently limited to post in a reply and still provide the information that others need.

larryd:
Where is:

void loop()
{
}

There is no such thing as an if loops

int MIN;
int MAX;
. . .
MAX=35.4 // How does these work for you?
. . .
MIN=32.2;

Every } needs a friend {

thank you so much
I've corrected those mistakes
but the error is still the same!

new code and error code is attached below.

sen_vazn_temp.ino (2.01 KB)

error.txt (7.03 KB)

R0UGH:
thank you so much
I've corrected those mistakes
but the error is still the same!

new code and error code is attached below.

this is not a whole program as you see
I get "units" from a load cell as input also "sen" in hours from a keypad
then I calculate "MIN" and "MAX" and send them back to my main function
so all I wrote above, will be used in a separate function, not void setup, neither void loop

I guess I found the problem
I forgot to comment stars! (//******)

You are going to get into a litlle bit of a mess with this approach.

Look at the resounces->reference (at the top of this page).

Learn about arrays.
Learn switch case.

These two are both applicable to your requirement but will make it a lot easier once you understand how to use them.

This is not code, get rid of it.

***************************************************************************************

If you want a separator add comment slashes ( // ).

//*************************************************************************************
if (sen>0 && sen<12){
  MIN=32.8;
  MAX=33.8;
  }
else if (sen>12 && sen<24){

What happens when sen == 12 ?

Compiles fine for me after commenting out the "*************" lines and fixing two places where "sen < 96" got changed to "sen96".

float units;
int sen;
float MIN;
float MAX;

void setup () {

  //***************************************************************************************
  if (units > 1200) {

    if (sen > 0 && sen < 12) {
      MIN = 34;
      MAX = 35.4;
    }
    else if (sen > 12 && sen < 24) {
      MIN = 34;
      MAX = 35.4;
    }
    else if (sen > 24 && sen < 48) {
      MIN = 34;
      MAX = 35;
    }
    else if (sen > 48 && sen < 96) {
      MIN = 34;
      MAX = 35;
    }
    else if (sen > 96 && sen < 336) {
      MIN = 33;
      MAX = 34;
    }
    else if (sen > 336 && sen < 504) {
      MIN = 32.2;
      MAX = 34;
    }
    else if (sen > 504 && sen < 672) {
      MIN = 31.5;
      MAX = 33.5;
    }
  }
  // ***************************************************************************************
  else if (units > 1200 && units < 1500) {


    if (sen > 0 && sen < 12) {
      MIN = 33.9;
      MAX = 34.4;
    }
    else if (sen > 12 && sen < 24) {
      MIN = 33.3;
      MAX = 34.3;
    }
    else if (sen > 24 && sen < 48) {
      MIN = 33;
      MAX = 34.2;
    }
    else if (sen > 48 && sen < 96) {
      MIN = 33;
      MAX = 34;
    }
    else if (sen > 96 && sen < 336) {
      MIN = 33;
      MAX = 34;
    }
    else if (sen > 336 && sen < 504) {
      MIN = 32.2;
      MAX = 34;
    }
    else if (sen > 504 && sen < 672) {
      MIN = 31.5;
      MAX = 33.5;
    }
  }
  //***************************************************************************************
  else if (units > 1500 && units < 2500) {


    if (sen > 0 && sen < 12) {
      MIN = 32.8;
      MAX = 33.8;
    }
    else if (sen > 12 && sen < 24) {
      MIN = 31.8;
      MAX = 33.8;
    }
    else if (sen > 24 && sen < 48) {
      MIN = 31.5;
      MAX = 33.5;
    }
    else if (sen > 48 && sen < 96) {
      MIN = 31.2;
      MAX = 33.3;
    }
    else if (sen > 96 && sen < 336) {
      MIN = 31;
      MAX = 33;
    }
    else if (sen > 336 && sen < 504) {
      MIN = 30.7;
      MAX = 32.8;
    }
    else if (sen > 504 && sen < 672) {
      MIN = 30;
      MAX = 32.7;
    }
  }
  //***************************************************************************************
  else if (units > 2500) {


    if (sen > 0 && sen < 12) {
      MIN = 32;
      MAX = 33.8;
    }
    else if (sen > 12 && sen < 24) {
      MIN = 31;
      MAX = 33.7;
    }
    else if (sen > 24 && sen < 48) {
      MIN = 30.5;
      MAX = 33.3;
    }
    else if (sen > 48 && sen < 96) {
      MIN = 30.5;
      MAX = 33;
    }
  }
}

void loop () {

}
void setup () {

  //***************************************************************************************
  if (units > 1200) {

    if (sen > 0 && sen < 12) {

I'm hoping the compiler is sensible enough to know here that units == 0 and sen == 0