Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Help with programming Solenoids (http://www.chiefdelphi.com/forums/showthread.php?t=125209)

ShakespeareIJP 25-01-2014 11:35

Help with programming Solenoids
 
I am terrible at programming anything pneumatic related, and solenoids are unfortunately no exception. Netbeans keeps getting an illegal start of expression.
Here is my code:


package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Solenoid;

public class Solenoids {


private Solenoid uno;
private Solenoid dos;

private boolean solenoidBoo = false;



public MySolenoid(1 , 2){
solenoidBoo = true;
uno = new Solenoid(8, 1);
dos = new Solenoid(8, 2);
System.out.println("We have liftoff" + 1 + " and " + 2);
}




public void extend() {
uno.set(true);

if(solenoidBoo) {
dos.set(false);
}
}


public void retract() {
uno.set(false);

if(solenoidBoo) {
dos.set(true);
}
}


public boolean get() {
return this.uno.get();
}

public boolean getDos() {
boolean otherBoo = dos.get();
return otherBoo;
}
}

Joe Ross 25-01-2014 13:42

Re: Help with programming Solenoids
 
Your code would be easier to read if you enclosed it in [ code] tags. It would also be helpful if you said what line Netbeans was complaining about.

Quote:

Originally Posted by ShakespeareIJP (Post 1332090)
public MySolenoid(1 , 2){
solenoidBoo = true;
uno = new Solenoid(8, 1);
dos = new Solenoid(8, 2);
System.out.println("We have liftoff" + 1 + " and " + 2);
}

What are you trying to do here? public MySolenoid(1 , 2) isn't valid syntax for a class declaration, constructor, or method.

In addition, you'll get a runtime error for uno = new Solenoid(8, 1); because 8 isn't a valid solenoid module.


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

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