Can someone PLEASE explain the error at the second set of DIRECTION.
const int STEP = 1; // Step BiT FOr Motor
const int DIRECTION = 2; // DIRECTION 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
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(10) ; // Waits for 100 milliseconds
digitalWrite( STEP, LOW); // Turns the Step Bit off
delay(10); // Waits for 100 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( 1000)
delay(10) ; // Waits for 100 milliseconds
digitalWrite( STEP, LOW); // Turns the Step Bit off
delay(10); // Waits for 100 milliseconds
}
}