Paso 20: código
Código para el Arduino es:
#include < Servo.h >
Servo myservo; Chi int = 0;
void setup () {myservo.attach(5);
} void loop)
{myservo.write(90);
Chi = analogRead (0); si (Chi > 800) {}
myservo.Write (85); delay (1000);
myservo.Write (80); delay (1000);
myservo.Write (75); delay (1000);
myservo.Write (70); delay (1000);
myservo.Write (65); delay (1000);
myservo.Write (60); delay (1000);
myservo.Write (55); delay (1000);
myservo.Write (50); delay (1000);
myservo.Write (45); delay (1000);
myservo.Write (40); delay (1000);
myservo.Write (35); delay (1000);
myservo.Write (30); delay (1000);
myservo.Write (25); delay (1500);
myservo.Write (20); delay (1500);
myservo.Write (15); delay (1500);
myservo.Write (10); delay (1500);
myservo.Write (5); delay (1500);
myservo.Write (0); delay (1500);
myservo.Write (90); delay (30000);
} else {}
retrasar (1000);}
}
El brazo debe trabajar como se muestra en la película.