My Code Will not Compile

if someone could tell me why this code fails to compile, I would greatly appreciate it.

const int STEP = 1;               // Step BiT FOr Motor 
const int CLOCK = SCL;            // SCL Serial Clock Bit 
const int DATA = SDA;             // SDA Serial Data Bit for the display
const int HOME = 5;               // Home Switch connected to digital pin 5
int DIRECTION = 1;                // DIRECTION BIT for Motor
int count = 0;                    // Generic count variable

void setup() {
 pinMode(STEP, OUTPUT);          // sets the digital pin as output
 pinMode(DIRECTION, OUTPUT);     // Sets the Direction as an output
 pinMode(HOME, INPUT);           // Sets the Home Pin as an Input
 
}

void loop() {

while(HOME == 0);{                // Step backward until we are not at home
DIRECTION = 0;                   //  Set the direction to go backward
digitalWrite(STEP, HIGH);        // Turns the Step Bit on
delay(5) ;                       // Waits for 5 milliseconds
digitalWrite( STEP, LOW);        // Turns the Step Bit off 
delay(5);                       // Waits for 5 milliseconds 
 }

while(HOME == 1);{                // Step forward until we are just off home
DIRECTION = 1;                   // Set the direction to go forward
digitalWrite(STEP, HIGH);        // Turns the Step Bit on delay(100)       
delay(5) ;                       // Waits for 5 milliseconds
digitalWrite( STEP, LOW);        // Turns the Step Bit off 
delay(5);                        // Waits for 5 milliseconds 

if (count == 0){
   DIRECTION = 1;                // Basically the same sequence as above
   digitalWrite(STEP, HIGH);     // but we will sequence this twice to ensure       
   delay(5) ;                    // we clear the home position by two steps
   digitalWrite( STEP, LOW);      
   delay(5);
     count = count++;
   DIRECTION = 1;                // 2nd time through
   digitalWrite(STEP, HIGH);            
   delay(5) ;                    
   digitalWrite( STEP, LOW);     // Next would be to update the Display
   delay(5);                     // We are Home and Ready to go
   Test();
   }
 
 }
void Test(){
 // Comment Only
}
}


}

Moderator edit: [code][/code] tags added. (Nick Gammon)

BCox5351@Yahoo.com

What was the error message?

If you read the forum rules, add code tags in your post and explain what the problem is (or the error messages like aarg said) "I would greatly appreciate it" too.

Well, maybe this code will compile:

const int STEP = 1;               // Step BiT FOr Motor
const int CLOCK = SCL;            // SCL Serial Clock Bit
const int DATA = SDA;             // SDA Serial Data Bit for the display
const int HOME = 5;               // Home Switch connected to digital pin 5
int DIRECTION = 1;                // DIRECTION BIT for Motor
int count = 0;                    // Generic count variable

void setup() {
  pinMode(STEP, OUTPUT);          // sets the digital pin as output
  pinMode(DIRECTION, OUTPUT);     // Sets the Direction as an output
  pinMode(HOME, INPUT);           // Sets the Home Pin as an Input

}

void loop() {

  while(HOME == 0);
  {                // Step backward until we are not at home
    DIRECTION = 0;                   //  Set the direction to go backward
    digitalWrite(STEP, HIGH);        // Turns the Step Bit on
    delay(5) ;                       // Waits for 5 milliseconds
    digitalWrite( STEP, LOW);        // Turns the Step Bit off
    delay(5);                       // Waits for 5 milliseconds
  }

  while(HOME == 1);
  {                // Step forward until we are just off home
    DIRECTION = 1;                   // Set the direction to go forward
    digitalWrite(STEP, HIGH);        // Turns the Step Bit on delay(100)       
    delay(5) ;                       // Waits for 5 milliseconds
    digitalWrite( STEP, LOW);        // Turns the Step Bit off
    delay(5);                        // Waits for 5 milliseconds

    if (count == 0){
      DIRECTION = 1;                // Basically the same sequence as above
      digitalWrite(STEP, HIGH);     // but we will sequence this twice to ensure       
      delay(5) ;                    // we clear the home position by two steps
      digitalWrite( STEP, LOW);     
      delay(5);
      count = count++;
      DIRECTION = 1;                // 2nd time through
      digitalWrite(STEP, HIGH);           
      delay(5) ;                   
      digitalWrite( STEP, LOW);     // Next would be to update the Display
      delay(5);                     // We are Home and Ready to go
      Test();
    }

  }
}

void Test(){
  // Comment Only
}

The brackets didn’t matches.

Your {}'s are all screwed up. I can't tell how you want it from looking at the code.

Functions cannot be defined within another function - but I don't think this is what you meant to do.

while(HOME == 1);{ should not have a semicolon in it.

Change the end of your code like this to fix up the { }s

      Test();
    }

  }
}
void Test(){
  // Comment Only
}

I always type the beginning and end bracket at the same time as I type the conditional. That way I won't forget or get mixed up about where they belong. Then I fill in the lines inside the block.

while(HOME == 0);{                // Step backward until we are not at home
...
while(HOME == 1);{                // Step forward until we are just off home

http://www.gammon.com.au/tips#trap13