Browse Source

Update v1.3

master
Evangelos Oulis 5 years ago
parent
commit
a61278edfb
  1. 13
      autonomousCar/autonomousCar.ino

13
autonomousCar/autonomousCar.ino

@ -53,6 +53,7 @@
/*Definition for turn time*/ /*Definition for turn time*/
#define TURN_TIME 800 #define TURN_TIME 800
#define FORWARD_STEP 200
/* /*
* ------------------------------------------------------- * -------------------------------------------------------
@ -257,9 +258,9 @@ void moveCar(){
void park(int parkingNo) { void park(int parkingNo) {
int row = (parkingNo / 2) + 1; int row = (parkingNo / 2) + 1;
int side = (parking % 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.
distance= getDistance(); //take the distance from ultrasonic sensor distance = getDistance(); //take the distance from ultrasonic sensor
while (row > 1) { while (row > 1) {
absolute(255); absolute(255);
@ -273,6 +274,7 @@ void park(int parkingNo) {
//Check the side value to turn. //Check the side value to turn.
if (side == 1) { if (side == 1) {
turnRight(255); turnRight(255);
}
else { else {
turnLeft(255); turnLeft(255);
} }
@ -291,7 +293,13 @@ void park(int parkingNo) {
int Serial_Input() int Serial_Input()
{ {
int number; int number;
<<<<<<< HEAD
while (!Serial.available()) ; while (!Serial.available()) ;
=======
Serial.flush();
while(!Serial.available()) ;
>>>>>>> dce72c29be70c5124af0193dc8a435a5deb10bfb
if (Serial.available() > 0) { if (Serial.available() > 0) {
number = Serial.parseInt(); number = Serial.parseInt();
while (number <= 0) { while (number <= 0) {
@ -317,7 +325,6 @@ void loop() {
//Serial.print("Distance: "); //Serial.print("Distance: ");
//Serial.println(distance); //Serial.println(distance);
// Read serial input: // Read serial input:
park(Serial_Input()); park(Serial_Input());
//delay(1000); //delay(1000);
// if (distance <15) { // if (distance <15) {

Loading…
Cancel
Save