Things used in this project

Code

FIZZQV0IZ6D1PFF.inoArduino
#define trigPin1 A0
#define echoPin1 A1

#define trigPin2 A2
#define echoPin2 A3

#define trigPin3 A4
#define echoPin3 A5


#define motor1 5
#define motor2 6
#define buzzer 3

void setup()
{
pinMode(trigPin1, OUTPUT);

pinMode(echoPin1, INPUT);

pinMode(trigPin2, OUTPUT);

pinMode(echoPin2, INPUT);

pinMode(trigPin3, OUTPUT);

pinMode(echoPin3, INPUT);


pinMode(motor1, OUTPUT);

pinMode(motor2, OUTPUT);

pinMode(buzzer,OUTPUT);

}

void loop()

{

long duration, distance;

digitalWrite(trigPin1, LOW); 

delayMicroseconds(2); 

digitalWrite(trigPin1, HIGH);

delayMicroseconds(1); 

digitalWrite(trigPin1, LOW);

duration = pulseIn(echoPin1, HIGH);

distance = (duration/2) / 29.1;

if (distance < 45)

{ 

 

digitalWrite(buzzer,HIGH);

} else

{



digitalWrite(buzzer,LOW); 

} delay(50);



digitalWrite(trigPin2, LOW); 

delayMicroseconds(2); 

digitalWrite(trigPin2, HIGH);

delayMicroseconds(1); 

digitalWrite(trigPin2, LOW);

duration = pulseIn(echoPin2, HIGH);

distance = (duration/2) / 29.1;

if (distance < 40)

{ 

digitalWrite(motor1,HIGH);



} else

{

digitalWrite(motor1,LOW);

 

} delay(100);




digitalWrite(trigPin3, LOW); 

delayMicroseconds(2); 

digitalWrite(trigPin3, HIGH);

delayMicroseconds(2); 

digitalWrite(trigPin3, LOW);

duration = pulseIn(echoPin3, HIGH);

distance = (duration/2) / 29.1;

if (distance < 30)

{ 

digitalWrite(motor2,HIGH); 

} else

{

digitalWrite(motor2,LOW);

 

} delay(100);

}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Pool Buddy
Intermediate
  • 1,552
  • 11

Work in progress

Monitor and log water quality (pH & ORP) and temperature from everywhere.

Smart Garden
Intermediate
  • 2,088
  • 18

Smart Garden is a plant environmental monitoring system.

WiFi Messenger
Intermediate
  • 1,265
  • 14

Protip

Calling my son from his room using 2 ESP8266 modules, instead of shouting.

Voice Controled Click Lamps
Intermediate
  • 66
  • 2

Work in progress

We have a couple of floor lamps from Ikea. They have two lights in each, and a switch for each light. Let's control them remotely.

IoT Thermometer Using Python
Intermediate
  • 893
  • 8

Full instructions

How to develop a simple but powerful IoT thermometer using a Zerynth-powered single-board MCU and the Zerynth App.

Both Physical & Cloud Cayenne Lights Switch
Intermediate
  • 125
  • 2

The cloud switches are well known, but what happens when the local internet fails and the switch cannot connect to the internet?

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback