@DevineIshaq107

int trig1=13,trig2=4,trig3=5,trig4=6,trig5=7,echo1=12,echo2=9,echo3=10,echo4=11,echo5=12;
long duration,distance,slot1,slot2,slot3,slot4,slot5;
void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
pinMode(trig1,OUTPUT);pinMode(echo1,INPUT);
pinMode(trig2,OUTPUT);pinMode(echo2,INPUT);
pinMode(trig3,OUTPUT);pinMode(echo3,INPUT);
pinMode(trig4,OUTPUT);pinMode(echo4,INPUT);
pinMode(trig5,OUTPUT);pinMode(echo5,INPUT);
}
void ultra(int trig, int echo)
{
  digitalWrite(trig,LOW);
  delay(10);
  digitalWrite(trig,HIGH);
  delay(10);
  digitalWrite(trig,LOW);
  duration=pulseIn(echo,HIGH);
  distance=(duration/2)*0.0341;
  //return distance;
}
void loop() {
  // put your main code here, to run repeatedly:
ultra(trig1,echo1);slot1=distance;Serial.print("Sensor2");Serial.print(slot2);

  

//Right now I am just getting the feel of the codes so I commented out the 4 sensors
//ultra(trig2,echo2);slot2=distance;Serial.print("Sensor2");Serial.print(slot2);
//ultra(trig3,echo3);slot3=distance;Serial.print("Sensor3");Serial.print(slot3);
//ultra(trig4,echo4);slot4=distance;Serial.print("Sensor4");Serial.print(slot4);
//ultra(trig5,echo5);slot5=distance;Serial.print("Sensor5");Serial.print(slot5);
//if(slot1<15)Serial.println("slot1 is booked");
//else Serial.println("slot1 is free");
//if(slot2<15)Serial.println("slot2 is booked");
//else Serial.println("slot2 is free");
//if(slot3<15)Serial.println("slot3 is booked");
//else Serial.println("slot3 is free");
//if(slot4<15)Serial.println("slot4 is booked");
//else Serial.println("slot4 is free");
//if(slot5<15)Serial.println("slot5 is booked");
//else Serial.println("slot5 is free");

delay(100);
}

have fun build your autonomous rover

@edsconections

You can add altitude or proximity to the sensor

@ninaeba

hi. need some help. I want to connect 36 ultrasonic sensor to arduino. How to do it and which arduino i need?

@sciencezone9802

Your second code is very easy for beginners. Thanks bro. I did little success because of you.

@DouweMiedema

thank you very much just what i was looking for

@shadowfighter7085

Thanks man❤

@srikanthm.r9465

Will this work if I replace one of the LEDs with a moter ,Or should I change the code

@Burntoeye

Excellent video... but I have a dubt! 
How many sensors can I use in this Arduino?

@unglaubichuberlieber8048

your schematic and code looks great, any chance you can send me a snap shot of the breadboard on how you
connected the sensors ??? thanks in advance

@billalalamarie8852

Is there a way I can make one of the ultrasonic sensors take priority over the other three if it is closer. Basically, I'm trying to get one ultrasonic sensor on while the others turn off if that one is detecting a distance.

@Mohhhho3042

thanks ! it helped a lot!!!!

@javierguizar

Muy bueno, me faltan los LED's,  me sirvió de mucho y me dio ideas, saludos...

@MareliMendozaFidel

el codigo me marca un error  pero lo copeo tal y como esta en el link

@KiransKKWORLD

can we use arduino uno for this project

@umairashafq9912

Can i get the circuit diagram for it please ...

@nelsonsantos4537

Thaks Bro!!

@tahakhan3343

Hi I am actually making my Final Year project. And I have to use four sensor in an arduino. So can i use 4 sensors or more in one arduino or in one mega-arduino?

@TheLoweren

do you use newping ?

@edsconections

whether the sensor distance can be adjusted

@marielsophianicoleso1533

Hi, may I ask what would be the changes if I use a buzzer??