@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

@sciencezone9802

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

@shadowfighter7085

Thanks man❤

@DouweMiedema

thank you very much just what i was looking for

@Mohhhho3042

thanks ! it helped a lot!!!!

@nelsonsantos4537

Thaks Bro!!

@javierguizar

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

@Burntoeye

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

@MareliMendozaFidel

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

@srikanthm.r9465

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

@marielsophianicoleso1533

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

@edsconections

You can add altitude or proximity to the sensor

@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

@edsconections

whether the sensor distance can be adjusted

@TheLoweren

do you use newping ?

@marymunem7059

Thank you very much 🌟
Is there a way to use ultrasonic for length measurement ?

@raedasmeheen6543

Excuse me, I want to make 2 for the length, 2 for the width, and 1 for the height. Can you do it for us?

@mohithachappidi7831

If you how to connect it, then it would be far better

@ninaeba

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

@himanshuladwe3344

Sir,can you send image how to connect jumper wire on Mega arudino ,Bcoz in am new in using arudino and I really like your project 
I also want to use it in 🏫 school