Browse Source

Update v1.1

master
cs161079 5 years ago
parent
commit
04372c2590
  1. 17
      autonomousCar/autonomousCar.ino

17
autonomousCar/autonomousCar.ino

@ -92,11 +92,7 @@ void turnServo(int from, int deg){
} }
} }
void serialFlush(){
while(Serial.available() > 0) {
char t = Serial.read();
}
}
/* /*
* Setup Wiring Components * Setup Wiring Components
*/ */
@ -125,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
@ -261,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.
@ -294,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) {

Loading…
Cancel
Save