how to control continuous servo(moded) with joystick module with some conditions

​hey guys i want a little help for my project...........
​i want to control 4 servos with 2 joystick module,( with one joystick i want to control 2 servos from each axis)
i made the servo to rotate continuous by using some help from you tube

now i want that if i push the stick up than the servo start rotating and keep rotating until i release the pressure and when i release the pressure from stick the servo should stop immediately and when i push the stick down the servo start rotating in opposite direction (same for other axis with other servo ) , speed doesn't matter for me in this case i just want to use the stick as switches like when i push up it should start rotate clockwise and when i push down it start rotate counter clockwise,

can somebody please help me with the code and connection to the arduino.

thanks in advance.. :slight_smile:

Start simple - with just one servo. When you have that working add a servo for the other axis. When that works it should be straightforward to add a second servo for each axis - all the planning and calculations will have been figured out.

The code for a single servo should be something like this pseudo code

   joystickAval = analogRead(joystickApin);
   joystickAval = joystickAval - 512; // to give range +512 to -512 with 0 at centre

   if (joystickAVal > 50) {  // allow a dead zone at the centre
      servoA.write(speedVal); // whatever fixed speed you want
      // servoA.write(joystickAval / 2); // if you want the servo speed to relate to the stick position
   }
   if (joystickAval < 50) {
       // leave you to fill in the rest
   }

...R