When I tested this code I held the joystick down, which made the wheels move, but when I let go the motors would keep moving. Any help is appreciated. I used two custom libraries which are attached to this message. (This was tested using ROBOTC 3.54.)

const int deadzone = 10;task main(){ while(true){ getJoystickSettings(joystick); float degrees = JoystickDegrees(1, 1); //This finds the value for the degrees of the first joystick and assigns it to a float. float power = JoystickPower(1, 1); //This finds the value for how far the joystick is away from the center and assings it to a float. float power2 = JoystickPower(1, 2); //This does the same thing as line 15 but for the second joystick on controller one. degrees = -degrees + 90; //This fixes the degrees power = power / 1.27; //This and line 19 reduces the joystick values down to 100. power2 = power2 / 1.27 && -power2 + 90;

What does this do? More specifically, what happens if the joystick value is -9 to +9? This 'stop' condition only becomes true if one of the joysticks is exactly at a 10 value; otherwise, the condition is false, the motors are not stopped, and the last movement condition is held.

This should check to see if the y1 value is less than +10 AND greater than -10 AND if the x1 value is less than +10 AND greater than -10 (basically, if the joystick is within a +-10 deadzone), then the move function will be send values of 0.

This should check to see if the y1 value is less than +10 AND greater than -10 AND if the x1 value is less than +10 AND greater than -10 (basically, if the joystick is within a +-10 deadzone), then the move function will be send values of 0.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum