Keyestudio 4DOF Manual page 188

Robot mechanical arm kit for arduino diy
Hide thumbs Also See for 4DOF:
Table of Contents

Advertisement

Test Code 7:
*******************************************************************************************************************************
#include <Servo.h> // add the servo libraries
Servo myservo1; // create servo object to control a servo
Servo myservo2;
Servo myservo3;
Servo myservo4;
int pos1=80, pos2=60, pos3=130, pos4=0; // define the variable of 4 servo angle and assign the initial value( that is the boot posture
angle value)
const int right_X = A2; // define the right X pin to A2
const int right_Y = A5; // define the right Y pin to A5
const int right_key = 7; // define the right key pin to 7(that is Z value)
const int left_X = A3; //define the left X pin to A3
const int left_Y = A4; // define the left Y pin to A4
const int left_key = 8; // define the left key pin to 8(that is Z value)
int x1,y1,z1; // define the variable, used to save the joystick value.
int x2,y2,z2;
int s1,s2,s3,s4;
int jiyi1[20]; //define 4 array, separately used to save the angle of four servo.
int jiyi2[20]; // (array length is 20,namely can save angle data of 0~20 servo)
int jiyi3[20]; //if need to save more data, just change the number 20 to be more larger number.
185

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents