|
Re: TOGGLE code not working
One subtlety of programming that new programmers often miss out on is correctly naming variables.
In your program, I'd consider renaming Button2Value to Button2WasPressed, BackwardToggle to DriveBackwards, NecessaryTest to something like SpeedDifference, and LeftDrive/RightDrive to LeftPower/RightPower. You can easily do so by right clicking on the variable, and selecting Refactor -> Rename.
Making those changes makes your program easier to comprehend.
Down in the if (stick1.getTrigger()) blocks are you intending to change those to use BackwardToggle?
You don't need to say
else if(stick1.GetRawButton(2) == true)
because it's the opposite of the first test for false -- you can just say "else".
Is it your intent for driving to work only when the trigger is pulled?
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament
2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
|