i could really use some help with my arduino project it is 2 motors controlled in tandem by a joystick, or it would be if i could get it to work. i have a code for the motors to run separately it is this:
#include <Servo.h>
const int servo1 = 3; // first servo
const int servo2 = 10; // second servo
const int joyH = 3; // L/R Parallax Thumbstick
const int joyV = 4; // U/D Parallax Thumbstick
int servoVal; // variable to read the value from the analog pin
Servo myservo1;
Servo myservo2;
void setup() {
myservo1.attach(servo1);
myservo2.attach(servo2);
Serial.begin(9600);
}
void loop(){
outputJoystick();
servoVal = analogRead(joyH);
servoVal = map(servoVal, 0, 1023,1000, 1750);
myservo2.write(servoVal);
servoVal = analogRead(joyV);
servoVal = map(servoVal, 0, 1023, 1250, 1750);
myservo1.write(servoVal);
delay(15);
}
/**
- Display joystick values
*/
void outputJoystick(){
Serial.print(analogRead(joyH));
Serial.print ("---");
Serial.print(analogRead(joyV));
Serial.println ("----------------");
}
but what i need it to do is run both of the DC motors in tandem and the bot needs to be able to make zero point turns. any help at all would be extremely helpful, thank you for your time