Search the Blog

Thursday, August 15, 2019

Arduino uno board complete code of ROBOT

Arduino Uno board Code for maze robot for path ROBOT

Arduino uno board complete code of ROBOT


#include<Servo.h>


Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;

int amsr=9;
int amsl=7;
int amskr=10;
int amskl=8;




int aamsl;


void setup()
{


  servo2.attach(amsr);
  servo1.attach(amskr);
  servo3.attach(amsl);
  servo4.attach(amskl);

}


void loop()
{

 {
  for(aamsl=150;aamsl>30;aamsl--)
  {
    int ab=180-aamsl;
    servo2.write(aamsl);
    servo3.write(ab);
  delay(3);
  }
  delay(1000);
  for(int i=1;i<=3;i++)
  {
  for(aamsl=150;aamsl>60;aamsl--)
  {
    int fg=aamsl-50;
    servo1.write(aamsl);
    servo4.write(fg);
  delay(20);
  }
  delay(1000);
  for(aamsl=60;aamsl<150;aamsl++)
  {
    int fd=aamsl+50;
    servo1.write(aamsl);
    servo4.write(fd);
  delay(20);
  }
  }
  delay(1000);
  for(aamsl=30;aamsl<150;aamsl++)
  {
    int cd=180-aamsl;
    servo2.write(aamsl);
    servo3.write(cd);
  delay(20);
  }
  delay(1000);

 }
}


JAVA Triangle * Pattern Program Logic one Programming Logic and Code with Syntax

Arduino Uno board with servo test

Arduino Uno board with servo test with actual and tested example

Arduino Uno board with servo test with actual and tested example Varified

#include <Servo.h>

Servo myservo3;

Servo myservo5;

Servo myservo6;

int potpin = 0;
int potpin2 = 1;

int potpin3 = 2;

int val = 0;
int val2 = 0;

int val3 = 0;

void setup()
{

myservo3.attach(9);
myservo5.attach(10);

myservo6.attach(11);

}

void loop()
{

val = analogRead(potpin);
val = map(val, 3, 1023, 0, 176);

myservo3.write(val);

delay(25);

val2 = analogRead(potpin2);
val2 = map(val2, 3, 1023, 0, 176);

myservo5.write(val2);

delay(25);

val3 = analogRead(potpin3);
val3 = map(val3, 3, 1023, 0, 175);

myservo6.write(val3);

delay(25);

}


JAVA Sequence Pattern Program Programming Logic and Code with Syntax

Arduino uno board Code for Ultrasonic sensor with relay

Arduino UNO Board Code For Ultrsonic Sensor with Realy and LED Pin for High and LOW Demo

Arduino uno board Code for Ultrasonic sensor with relay and Demo Example

#define echoPin 7
#define trigPin 8
#define LEDPin 12
int relay1=2;
int relay2=3;
int relay3=4;
int relay4=5;
int i=1,s;
int a=10,b=10,c=10,d=10;
int maximumRange = 200;
int minimumRange = 0;
long duration, distance;

void setup()
{
 Serial.begin (9600);
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin,  INPUT);
 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;
switch(i)
{
  case 1:
  {
    while(a<1000)
      {
        digitalWrite(relay4,LOW);
         digitalWrite(relay1,HIGH);
       
         while(distance<5)
         {
           digitalWrite(relay1,LOW);
           delay(1000);
           s=2;
           a=1000;
             break;
         }
         delay(100);
         a=a+100;
      }
      s=2;
      a=100;
      break;
  }
      case 2:
   { 
      while(b<1000)
      {
        digitalWrite(relay1,LOW);
         digitalWrite(relay2,HIGH);
         delay(100);
         while(distance<5)
         {
           digitalWrite(relay2,LOW);
           delay(1000);
           s=3;
           b=1000;
             break;
         }
        delay(100);
         b=b+100;
      }
      s=3;
      b=100;
      break;
   
   }
   case 3:
   { 
      while(c<1000)
      {
         digitalWrite(relay2,LOW);
         digitalWrite(relay3,HIGH);
       
         while(distance<5)
         {
           digitalWrite(relay3,LOW);
           delay(1000);
           s=4;
           c=1000;
             break;
         }
         delay(100);
         c=c+100;
      }
      s=4;
      c=100;
      break;
   }
   case 4:
 {   
      while(d<1000)
      {
        digitalWrite(relay3,LOW);
         digitalWrite(relay4,HIGH);
       
         while(distance<5)
         {
           digitalWrite(relay4,LOW);
           delay(1000);
           s=1;
           d=1000;
             break;
         }
         delay(100);
         d=d+100;
      }
      s=1;
      d=100;
      break;
 }
}
delay(1000);
i=s;
}


SQL Query for Purchase Order details Programming Logic and Code with Syntax





Translate