Search the Blog

Thursday, August 15, 2019

Arduino Code for ultrsonic RADAR

Micocontroller,  ROBOTICS,  Arduino Uno Board Project Example fro School and Science exibiation and College Projects.

Micocontroller,  ROBOTICS,  Arduino Uno Board Project Example fro School and Science exibiation.

#define echoPin 7
#define trigPin 8
#define LEDPin 13
int relay1=2;
int relay2=3;
int relay3=4;
int relay4=5;
int maximumRange = 200;
int minimumRange = 0;
long duration, distance;

void setup() {
 Serial.begin (9600);
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin,  OUTPUT);
  pinMode(relay1,  OUTPUT);
   pinMode(relay2,  OUTPUT);
    pinMode(relay3,  OUTPUT);
     pinMode(relay4, OUTPUT);
}

void loop() {

 digitalWrite(trigPin, LOW);
 delayMicroseconds(2);

 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10);

 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH);


 distance = duration/58.2;

 if (distance >25)

 {
   digitalWrite(relay1,HIGH);
   delay(5000);
   digitalWrite(relay1,LOW);
   digitalWrite(relay2,HIGH);
   delay(5000);
 
   digitalWrite(relay2,LOW);
   digitalWrite(relay3,HIGH);
   delay(5000);
 
   digitalWrite(relay3,LOW);
   digitalWrite(relay4,HIGH);
   delay(5000);
 
   digitalWrite(relay4,LOW);

   delay(5000);
 
 }

 delay(50);
}


JAVA Sequence Pattern Program with * pattern Programming Logic and Code with Syntax

No comments:

Post a Comment

Translate