View Single Post
  #2   Spotlight this post!  
Unread 10-03-2016, 17:16
josephno1's Avatar
josephno1 josephno1 is offline
Registered User
FRC #3647
Team Role: Programmer
 
Join Date: Oct 2015
Rookie Year: 2015
Location: murica
Posts: 21
josephno1 is an unknown quantity at this point
Re: Compressor Programming in LabView

Sorry I have never used LabView.

We did something really similar in java. Here is our code

Code:
package org.usfirst.frc.team3647.subsystems;

import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.Timer;
//import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Solenoid;

import org.usfirst.frc.team3647.robot.*;

public class Piston {
	public static Talon rShooter = new Talon(1);

	public static void BallShooterPiston(){
		

		Solenoid pistonOut = new Solenoid(7); // creates a Solenoid object in
												// slot 7, channel 4.

		Solenoid pistonIn = new Solenoid(0);

		if (LogitechJoystick.leftBumper) // this shoots the ball out

		{
			Robot.shootTest1 = true;
			if (Robot.shootTest1 = !Robot.shootTest) {
				rShooter.set(-1);
				// lShooter.set(1);

				Timer.delay(2);

				pistonOut.set(true); // Pushes the piston out
				pistonIn.set(false);

				Timer.delay(2);

				pistonIn.set(true); // Pulls the piston in
				pistonOut.set(false);
				Robot.shootTest = true;
				rShooter.set(0);

			}

		}
		
		if (LogitechJoystick.rightBumper2) // this shoots the ball out

		{
			Robot.shootTest1 = true;
			if (Robot.shootTest1 = !Robot.shootTest) {
				rShooter.set(-0.5);
				// lShooter.set(1);

				Timer.delay(2);

				pistonOut.set(true); // Pushes the piston out
				pistonIn.set(false);

				Timer.delay(2);

				pistonIn.set(true); // Pulls the piston in
				pistonOut.set(false);
				Robot.shootTest = true;
				rShooter.set(0);

			}

		}
		
		if(LogitechJoystick.rightBumper){
			
			rShooter.set(.25);
		}

		else {
			rShooter.set(0);
			Robot.shootTest1 = false;
			Robot.shootTest = false;
			// lShooter.set(0);
		}

	}
}
__________________
Go Team 3647 Millennium Falcons!
Reply With Quote