I have 4 motor Vex 393. Can this sketch be manipulated?
#include <Servo.h>
Servo right_motor; // create servo object to control a servo
Servo left_motor;
Servo up_motor;
Servo roll_motor;
int right_pot = 0; // analog pin used to connect the potentiometer
int left_pot = 1;
int up_pot = 2;
int roll_pot = 3;
int right_var; // varying values of the potentiometer
int left_var;
int up_var;
int roll_var;
int right; // variables for servo
int left;
int up;
int roll;
void setup() {
right_motor.attach(8); // attaches the servo
left_motor.attach(9);
up_motor.attach(10);
roll_motor.attach(11);
}
void loop() {
right_var = analogRead(right_pot); // reads the value of the potentiometer (value between 0 and 1023)
right = map(right_var, 0, 1020, 1180, 1800); // scale it to use it with the servo (value
// between 1200 and 1800)
right_motor.writeMicroseconds(right); // sets the servo position according
// to the scaled value}
left_var = analogRead(left_pot);
left = map(left_var, 0, 1023, 1227, 1800);
left_motor.writeMicroseconds(left);
up_var = analogRead(up_pot);
up = map(up_var, 0, 1023, 1229, 1800);
up_motor.writeMicroseconds(up);
roll_var = analogRead(roll_pot);
roll = map(roll_var, 0, 1023, 1190, 1800);
roll_motor.writeMicroseconds(roll);
}