Está en la página 1de 3

#include <Servo.

h>

//Definicion de los servos

Servo servo1;

Servo servo2;

Servo servo3;

Int eje1=90;

Int eje2=90;

Int pinServo = 8;

Int angulo = 0;

Int boton1 = 2;

Int boton2 = 4;

Int botonA = 0;

Int botonB = 0;

Void setup(){

Servo1.attach(7);

Servo2.attach(6);

Servo3.attach(8);

Servo1.write(90);

Servo2.write(90);

Servo3.write(30);

pinMode(boton1,INPUT);

pinMode(boton2,INPUT);

Void loop(){

//SERVO 1

If (analogRead(0)<200 && eje1<180){

Eje1++;

Servo1.write(eje1);
}

If (analogRead(0)>700 && eje1>0){

Eje1--;

Servo1.write(eje1);

//SERVO 2

If (analogRead(1)<200 && eje2<180){

Eje2++;

Servo2.write(eje2);

If (analogRead(1)>700 && eje2>0){

Eje2--;

Servo2.write(eje2);

botonA = digitalRead(boton1);

botonB = digitalRead(boton2);

if(botonA == HIGH)

Angulo++;

If(30>=180)

Angulo=180;

If(botonB == HIGH)

Angulo--;

If(angulo<=0)

{
Angulo=0;

Servo3.write(angulo);

Delay(15);

También podría gustarte