Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Simple Pnuematics Program Issue (http://www.chiefdelphi.com/forums/showthread.php?t=133291)

LFRobotics 21-01-2015 16:54

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!

notmattlythgoe 21-01-2015 16:57

Re: Simple Pnuematics Program Issue
 
Are you getting an error saying doubleSolenoid doesn't exist?

GeeTwo 21-01-2015 17:10

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.


All times are GMT -5. The time now is 22:27.

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