|
@ -92,6 +92,7 @@ void turnServo(int from, int deg){ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
/*
|
|
|
* Setup Wiring Components |
|
|
* Setup Wiring Components |
|
|
*/ |
|
|
*/ |
|
@ -120,6 +121,13 @@ void setup() { |
|
|
Serial.begin(9600); // Starts the serial communication
|
|
|
Serial.begin(9600); // Starts the serial communication
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void serialFlush(){ |
|
|
|
|
|
while(Serial.available() > 0) { |
|
|
|
|
|
char t = Serial.read(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/*
|
|
|
/*
|
|
|
* Stepper Function for Servo. |
|
|
* Stepper Function for Servo. |
|
|
* 1st Step: straight |
|
|
* 1st Step: straight |
|
@ -256,7 +264,7 @@ void moveCar(){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void park(int parkingNo) { |
|
|
void park(int parkingNo) { |
|
|
int row = (parkingNo / 2) + 1; |
|
|
int row = (parkingNo / 2); |
|
|
int side = (parkingNo % 2); //If side is 1 then the parking is to right
|
|
|
int side = (parkingNo % 2); //If side is 1 then the parking is to right
|
|
|
// else if is 0 the parking is to left.
|
|
|
// else if is 0 the parking is to left.
|
|
|
|
|
|
|
|
@ -289,7 +297,7 @@ int Serial_Input() |
|
|
{ |
|
|
{ |
|
|
int number; |
|
|
int number; |
|
|
|
|
|
|
|
|
Serial.flush(); |
|
|
|
|
|
while(!Serial.available()) ; |
|
|
while(!Serial.available()) ; |
|
|
|
|
|
|
|
|
if (Serial.available() > 0) { |
|
|
if (Serial.available() > 0) { |
|
@ -300,6 +308,7 @@ int Serial_Input() |
|
|
//Serial.print("Value:");
|
|
|
//Serial.print("Value:");
|
|
|
//Serial.println(number);
|
|
|
//Serial.println(number);
|
|
|
// clear the string for new input:
|
|
|
// clear the string for new input:
|
|
|
|
|
|
serialFlush(); |
|
|
} |
|
|
} |
|
|
// if you get a newline, print the string, then the string's value:
|
|
|
// if you get a newline, print the string, then the string's value:
|
|
|
} |
|
|
} |
|
|