View Single Post
  #7   Spotlight this post!  
Unread 02-02-2016, 18:18
JacobD's Avatar
JacobD JacobD is offline
Registered User
AKA: Jacob
FRC #1672 (Mahwah Robo T-Birds)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2013
Location: New Jersey
Posts: 90
JacobD is an unknown quantity at this point
Re: Joystick Pneumatic Triggering

Quote:
Originally Posted by CjDace View Post
Hey! our team is trying to do basically the same thing and our code is hitting an error on the "kreverse/kforward" when we try to get our solenoid object do them. we used the code provided above so instead of that i will provide the declaration
Code:
public class Robot extends IterativeRobot {
	    /**
	     * This function is run when the robot is first started up and should be
	     * used for any initialization code.
	     * 
	     */  RobotDrive myDrive, catcherDrive;
	    	Joystick moveStick;
	    	Gyro scotbot;
	    	Solenoid S;
	    	
	    public void robotInit() {
	    	Talon TalLF = new Talon(0);
	    	Talon TalLR = new Talon(1);
	    	Talon TalRF = new Talon(2);
	    	Talon TalRR = new Talon(3);
	    	Talon TalCatcher = new Talon(4);
	    	Talon TalCatcher1 = new Talon(5);
	    	myDrive =  new RobotDrive(TalLF,TalLR,TalRF,TalRR);
	    	moveStick = new Joystick(0);
	    	catcherDrive = new RobotDrive(TalCatcher, TalCatcher1);
	    	scotbot = new ADXRS450_Gyro();
	    	Compressor c = new Compressor(0);
	    	Solenoid S = new Solenoid(1);
	    	
	    }
Is there something very obvious that im missing?
Yes, remember to recognize the scope of your object references. If you declare in robotInit():
Code:
Solenoid S = new Solenoid(1);
That object reference "S" only exists inside of the method robotInit(). So, put this code under public class robot {
Code:
Solenoid S;
and change your code in robotInit() to:
Code:
 S = new Solenoid(1);
Hint*** Do this for all objects ***
__________________
2013-2014: Electrical, Mechanical
2014-2017: Team Captain
Reply With Quote