Paso 18:
#include < Servo.h >
Elevación del servo;
Servo rotación;
int val = 0;
int Inicio = 10;
int siguiente = 7;
maniquí de int = 0;
const int pwmA = 3;
const int plegadoraUna = 9;
const int dirA = 12;
void setup()
{
Lift.Attach (2); //lift el pin2
Rotate.Attach (5), //rotate en pin 5
pinMode (comienzo, entrada); //pin 10 como entrada
pinMode (a continuación, salida); //pin 7 salida
digitalWrite (next, HIGH);
Lift.Write (80); //upright
Rotate.Write (135), pista de //face
retrasar (2000);
}
void loop()
{
Val=digitalRead(Start);
if(Val==Low)
{dummy = 1;
Lift.Write(85);
Delay(100);
Lift.Write(90);
Delay(100);
Lift.Write(95);
Delay(100);
Lift.Write(100);
Delay(100);
Lift.Write(105);
Delay(100);
Lift.Write(110);
Delay(100);
Lift.Write(115);
Delay(100);
Lift.Write(120);
Delay(100);
Lift.Write(125);
Delay(100);
Lift.Write(130);
Delay(100);
Lift.Write(135);
Delay(100);
Lift.Write(140);
Delay(100);
Lift.Write(145);
Delay(100);
Lift.Write(150);
Delay(100);
Lift.Write(155);
Delay(100);
Lift.Write(160);
Delay(100);
Lift.Write(165);
Delay(100);
Lift.Write(170);
Delay(100);
pinMode(dirA,OUTPUT);
pinMode(brakeA,OUTPUT);
digitalWrite (dirA, LOW); //forward
digitalWrite (plegadoraUna, LOW); //release de freno
analogWrite (pwmA, 255); //motor en max
Delay(20000);
Lift.Write(145);
Delay(100);
Lift.Write(135);
Delay(100);
Lift.Write (125); //lift un poco
Delay(800);
Rotate.Write(130);
Delay(100);
Rotate.Write(125);
Delay(100);
Rotate.Write(120);
Delay(100);
Rotate.Write(115);
Delay(100);
Rotate.Write(110);
Delay(100);
Rotate.Write(105);
Delay(100);
Rotate.Write(100);
Delay(100);
Rotate.Write(95);
Delay(100);
Rotate.Write(90);
Delay(100);
Rotate.Write(85);
Delay(100);
Rotate.Write(80);
Delay(100);
Rotate.Write(75);
Delay(100);
Rotate.Write(70);
Delay(100);
Rotate.Write(65);
Delay(100);
Rotate.Write(60);
Delay(100);
Rotate.Write(55);
Delay(100);
Rotate.Write(50);
Delay(100);
Lift.Write(140);
Delay(100);
Lift.Write(145);
Delay(100);
Lift.Write (150); //at catapulta
Delay(1000);
analogWrite(pwmA,0);
digitalWrite(brakeA,LOW);
Delay(3000);
Lift.Write(80);
Delay (1000); //upright
Rotate.Write(75);
Delay(200);
Rotate.Write(100);
Delay(200);
Rotate.Write(110);
Delay(200);
Rotate.Write(120);
Delay(200);
Rotate.Write(130);
Delay(100);
Rotate.Write(135);
Delay(100);
dummy = 0;
digitalWrite(next,LOW);
Delay(1000);
digitalWrite(next,HIGH);
}}