Go to Post FIRST games are complex and rely on design and intellectual capability much more than the average sport. - Chris is me [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 02-02-2016, 06:18 PM
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
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 07:25 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi