|
Re: Just began using Java
Change this line:
RobotDrive myDrive = new RobotDrive(1, 2);
to:
RobotDrive myDrive = new RobotDrive(2, 1);
Think about what's happening. When you push forwards on the joystick, the RobotDrive tells both motors (1 and 2) to drive forward, which works fine. Likewise, pulling the joystick backwards makes both motors go backwards.
But if you want to turn left (spin in place) then one motor has to go forwards and one has to go backwards. In this case, it picked the wrong ones, and as a result spins in the wrong direction. By switching the order you pass in the motors, you'll switch it's choice and it'll turn in the right direction.
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
|