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.