View Single Post
  #7   Spotlight this post!  
Unread 20-02-2015, 23:14
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: functions for auto

Quote:
Originally Posted by curtis0gj View Post
Would this be okay?

Code:
public class Auto {
	
	static Robot r
	public static void setRobot(Robot rob) {
		r = rob;
	}
And when I have this in do I need to put r in front of everything still?
yeah thats fine. If you don't want to put r in front of everything, you can either

1) rename r to robot (atleast it looks more professional...)
2)

Code:
public class Auto {
	
	static Robot r
        static RobotDrive drive
        static DigitalInput upperLimitSwitch
        //and so on for other stuff
	public static void setRobot(Robot rob) {
		r = rob;
                drive = r.drive;
                upperLimitSwitch = r.limit4;
	}
Reply With Quote