Go to Post It's cool to see that Shaun White is an active team member (6th person from top left). That guy must be amazing, as he can win a gold medal in snowboarding while also being active on a FIRST Robotics team. - Andy Baker [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-01-2015, 16:54
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
Simple Pnuematics Program Issue

Okay so I typed up a simple pnuematics program according to examples on WPILib to extend a cylinder for a second and then retract it.

Netbeans says that it "cannot find the symbol" when I say

Code:
solenoid1 = new DoubleSolenoid(1, 2);
It is referring to not being able to find the solenoid1

Here is the program:

Code:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.Driver2015.commands;

import edu.wpi.first.wpilibj.DoubleSolenoid;

/**
 *
 * @author FrankyMonez
 */
public class Solenoid1 extends CommandBase {
    
    public Solenoid1() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        doubleSolenoid = new DoubleSolenoid(1, 2);
        setTimeout(1);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        doubleSolenoid.set(DoubleSolenoid.Value.kForward);
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return isTimedOut();
    }

    // Called once after isFinished returns true
    protected void end() {
        doubleSolenoid.set(DoubleSolenoid.Value.kReverse);
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}
ANY help will be appreciated! THANKS!
Reply With Quote
  #2   Spotlight this post!  
Unread 21-01-2015, 16:57
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is online now
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,713
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Simple Pnuematics Program Issue

Are you getting an error saying doubleSolenoid doesn't exist?
Reply With Quote
  #3   Spotlight this post!  
Unread 21-01-2015, 17:10
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,564
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Simple Pnuematics Program Issue

You never defined the object doubleSolenoid anywhere. You first used it inside the constructor, and then tried to use it in a method. You need to add the declaration of the object as an instance variable.

Try adding "DoubleSolenoid doubleSolenoid;" between the two lines which begin with public.

Last edited by GeeTwo : 21-01-2015 at 17:12. Reason: more specific answer
Reply With Quote
Reply


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 08:36.

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