How to make robotic arm

                                


                                     CODE

 #include<Servo.h>

Servo motor1;

Servo motor2;

Servo motor3;


 void setup() {

    motor1.attach(5);

    motor2.attach(6);

    motor3.attach(7);

    motor1.write(0);

    motor2.write(0);

    motor3.write(0);

    pinMode(8,INPUT);

    digitalWrite(8, HIGH);

}


void loop(){

    int data = digitalRead(8);

     if(data==LOW){

    motor2.write(90);

    delay(500);

    motor1.write(90);

    delay(500);

    motor2.write(5);

    delay(500);

    motor3.write(50);

    delay(500);

    motor2.write(90);

    delay(500);

    motor1.write(0);

    delay(500);

    motor2.write(15);

    delay(500);

    motor3.write(0);

    delay(500);

    motor2.write(90);

    delay(500);

    }

     else{

            motor1.write(0);

            motor2.write(90);

            motor3.write(0);

     }

 }

Post a Comment

Previous Post Next Post

Contact Form