View Single Post
  #3   Spotlight this post!  
Unread 04-10-2016, 08:52 AM
GoldenGollem's Avatar
GoldenGollem GoldenGollem is offline
Java Programmer
FRC #2509 (Hutchinson Tigerbots)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2015
Location: Minnesota
Posts: 24
GoldenGollem is an unknown quantity at this point
Re: Limit Switch Programming

Here is the blank template that I am using to test the limit switch.
Code:
package org.usfirst.frc.team2509.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.DriverStation;

public class Robot extends IterativeRobot {
	Talon motor1 = new Talon(0);
	Joystick stick;
	DigitalInput limitSwitch;
	
    public void robotInit() {
        
    }
   
    public void autonomousInit() {
    	}

    public void autonomousPeriodic() {
    	}

    public void teleopPeriodic() {
        if (stick.getRawButton(1)){
        	motor1.set(0.5);
        	}else{ motor1.set(0.0); }
        if (stick.getRawButton(2)){
        	motor1.set(-0.5);
        	}else{ motor1.set(0.0); }
    }

    public void testPeriodic() {
    
    }
    
}

Last edited by GoldenGollem : 04-10-2016 at 01:01 PM.
Reply With Quote