Circuit for this project:
Programming to control it:
// letsarduino.com // [Project 23] - Arduino Controlled Robotic Arm - 6 SERVO Motors #include<Servo.h> Servo servo_1; Servo servo_2; Servo servo_3; Servo servo_4; Servo servo_5; int pos = 0; void setup() { servo_1.attach(1); servo_2.attach(2); servo_3.attach(3); servo_4.attach(4); servo_5.attach(5); } void loop() { servo_1.write(180); delay(1000); for(pos = 90; pos>=23; pos-=1) { servo_2.write(pos); delay(30); } servo_3.write(100); delay(1000); for(pos =45; pos < 175; pos += 1) { servo_4.write(pos); delay(20); } delay(1000); servo_5.write(10); delay(1000); for(pos = 175; pos>=90; pos-=1) { servo_4.write(pos); delay(20); } servo_2.write(90); delay(2000); servo_1.write(90); delay(1000); for(pos = 90; pos>=23; pos-=1) { servo_2.write(pos); delay(30); } servo_3.write(100); delay(1000); for(pos =90; pos < 175; pos += 1) { servo_4.write(pos); delay(15); } delay(1000); servo_5.write(30); delay(1000); delay(1000); for(pos = 175; pos>=45; pos-=1) { servo_4.write(pos); delay(20); } servo_2.write(90); delay(1000); }
No comments:
Post a Comment