View Single Post
  #9   Spotlight this post!  
Unread 03-02-2017, 22:42
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 445
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: VictorSP causes "Robots don't quit!"

Quote:
Just to make sure, where do I put the import and following code?
That depends on the type of project you've created. If it's a command based robot project, then hardware components (like motors) are usually encapsulated and controlled through a "Subsystem" class.

There's example code for subsystems here: https://wpilib.screenstepslive.com/s...ple-subsystems
and general information on the command based project here: https://wpilib.screenstepslive.com/s.../13809/c/88893

If you're using just a plain iterative robot project without calls to a Scheduler class / commands / subsystems, then the motor objects would typically be class variables of Robot.java, instantiated in the constructor, and the .set() methods would typically be called from within the TeleoperatedPeriodic() and AutonomousPeriodic() methods depending on what you're trying to do.


Regarding imports, those always go in the same place within a .java file. At the top preceding the line that specifies the class name. Eclipse will automatically put it in the right spot if you right click the red underlined text and select the add import option.
__________________
http://team2168.org
Reply With Quote