0% found this document useful (0 votes)
50 views

The Program For Control of The Manipulator of The Robotic Site

The program code controls 6 servo motors to manipulate a robotic arm. It attaches each servo to a controller object and sets its range of motion. The main loop cycles through positions for the servos, holding each for 5 seconds before moving to the next. If a sensor is triggered, it stops all servo movement.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

The Program For Control of The Manipulator of The Robotic Site

The program code controls 6 servo motors to manipulate a robotic arm. It attaches each servo to a controller object and sets its range of motion. The main loop cycles through positions for the servos, holding each for 5 seconds before moving to the next. If a sensor is triggered, it stops all servo movement.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

The program for control of the manipulator of the robotic site

#include <VarSpeedServo.h>
VarSpeedServo myservo1, myservo2, myservo3, myservo4, myservo5,
myservo6; // create servo object to control a servo
void setup() { // initialize serial:
pinMode(45,OUTPUT);
pinMode(44, OUTPUT);
myservo1.attach(2,740,2365); // attaches the servo on pin 2 to the servo object
myservo2.attach(3,760,2365); // attaches the servo on pin 3 to the servo object
myservo3.attach(4,720,2365); // attaches the servo on pin 4 to the servo object
myservo4.attach(5,720,2300); // attaches the servo on pin 5 to the servo object
myservo5.attach(10,670,2300); // attaches the servo on pin 10 to the servo
object
myservo6.attach(11,720,2300); // attaches the servo on pin 11 to the servo
object
myservo1.write(0,35,false);
myservo2.write(0,35,false);
myservo3.write(0,35,false);
myservo4.write(0,35,false);
myservo5.write(0,35,false);
myservo6.write(0,35,false);
delay(2000);
}
void loop()
{
myservo1.write(0,15,true);
myservo2.write(44,15,false);
myservo3.write(0,15,false);
myservo4.write(35,15,false);
myservo5.write(0,15,false);
myservo6.write(0,15,false);
delay(5000);
myservo1.write(0,15,false);
myservo2.write(44,15,false);
myservo3.write(0,15,false);
myservo4.write(35,15,false);
myservo5.write(0,15,false);
myservo6.write(50,15,false);
delay(5000);
myservo1.write(84,15,false);
myservo2.write(35,15,false);
myservo3.write(12,15,false);
myservo4.write(0,15,false);
myservo5.write(0,15,false);
myservo6.write(0,15,false);
delay(5000);}
A program that will manage the work of the entire site
#include <VarSpeedServo.h>
VarSpeedServo myservo1, myservo2, myservo3, myservo4, myservo5,
myservo6;
void setup() {
pinMode(45,OUTPUT);
pinMode(44, OUTPUT);
myservo1.attach(2,740,2365); // attaches the servo on pin 2 to the servo object
myservo2.attach(3,760,2365); // attaches the servo on pin 3 to the servo object
myservo3.attach(4,720,2365); // attaches the servo on pin 4 to the servo object
myservo4.attach(5,720,2300); // attaches the servo on pin 5 to the servo object
myservo5.attach(10,670,2300); // attaches the servo on pin 10 to the servo
object
myservo6.attach(11,720,2300); // attaches the servo on pin 11 to the servo
object
myservo1.write(0,35,false);
myservo2.write(0,35,false);
myservo3.write(0,35,false);
myservo4.write(0,35,false);
myservo5.write(0,35,false);
myservo6.write(0,35,false);
delay(2000);
}
void loop()
{
myservo1.write(0,15,true);
myservo2.write(44,15,false);
myservo3.write(0,15,false);
myservo4.write(35,15,false);
myservo5.write(0,15,false);
myservo6.write(0,15,false);
delay(5000);
myservo1.write(0,15,false);
myservo2.write(44,15,false);
myservo3.write(0,15,false);
myservo4.write(35,15,false);
myservo5.write(0,15,false);
myservo6.write(50,15,false);
delay(5000);
myservo1.write(84,15,false);
myservo2.write(35,15,false);
myservo3.write(12,15,false);
myservo4.write(0,15,false);
myservo5.write(0,15,false);
myservo6.write(0,15,false);
delay(5000);}
while (analogRead(A1)>750)
{
digitalWrite(44,HIGH);
digitalWrite(45,LOW);
}
else{
digitalWrite(44,LOW);
digitalWrite(45,LOW); //45 - вліво
delay(5000);
}
Program code with lock function
#include <VarSpeedServo.h>
VarSpeedServo myservo1, myservo2, myservo3, myservo4, myservo5,
myservo6;
void setup() {
pinMode(45,OUTPUT);
pinMode(44, OUTPUT);
attachInterrupt(digitalPinToInterrupt(21),servoStop,RISING);
myservo1.attach(2,740,2365); // attaches the servo on pin 2 to the servo object
myservo2.attach(3,760,2365); // attaches the servo on pin 3 to the servo object
myservo3.attach(4,720,2365); // attaches the servo on pin 4 to the servo object
myservo4.attach(5,720,2300); // attaches the servo on pin 5 to the servo object
myservo5.attach(10,670,2300); // attaches the servo on pin 10 to the servo
object
myservo6.attach(11,720,2300); // attaches the servo on pin 11 to the servo
object
myservo1.write(0,35,false);
myservo2.write(0,35,false);
myservo3.write(0,35,false);
myservo4.write(0,35,false);
myservo5.write(0,35,false);
myservo6.write(0,35,false);
delay(2000);
}
void loop()
{

myservo1.write(0,15,true);
myservo2.write(44,15,false);
myservo3.write(0,15,false);
myservo4.write(35,15,false);
myservo5.write(0,15,false);
myservo6.write(0,15,false);
delay(5000);
myservo1.write(0,15,false);
myservo2.write(44,15,false);
myservo3.write(0,15,false);
myservo4.write(35,15,false);
myservo5.write(0,15,false);
myservo6.write(50,15,false);
delay(5000);
myservo1.write(84,15,false);
myservo2.write(35,15,false);
myservo3.write(12,15,false);
myservo4.write(0,15,false);
myservo5.write(0,15,false);
myservo6.write(0,15,false);
delay(5000);}

while (analogRead(A1)>750)
{
digitalWrite(44,HIGH);
digitalWrite(45,LOW);
}
else{
digitalWrite(44,LOW);
digitalWrite(45,LOW); //45 - вліво
delay(5000);
}
void servostop(){
myservo1.stop();
myservo2.stop();
myservo3.stop();
myservo4.stop();
myservo5.stop();
myservo6.stop();
}

You might also like