View Single Post
  #4   Spotlight this post!  
Unread 16-02-2010, 18:18
Twisted eric's Avatar
Twisted eric Twisted eric is offline
Registered User
FRC #0581
 
Join Date: Jan 2010
Location: San Jose
Posts: 54
Twisted eric is an unknown quantity at this point
Re: Programming the teleop

code

package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Watchdog;
import edu.wpi.first.wpilibj.Compressor;


public class Demonized extends SimpleRobot {

RobotDrive drive = new RobotDrive(1, 2);
Joystick leftStick = new Joystick(1);
Joystick rightStick = new Joystick(2);
Watchdog Fenrir = Watchdog.getInstance();
Compressor Siberian = new Compressor(1,1);


public void autonomous() {
while(true && isAutonomous() && isEnabled())
for (int i = 0; i < 4; i++) {
Fenrir.feed();
drive.drive(0.5, 0.0); // drive 50% fwd 0% turn
Fenrir.feed();
drive.drive(0.0, 0.5);
}
drive.drive(0.0, 0.0); // drive 0% fwd, 0% turn
}

public void operatorControl() {
while (true && isOperatorControl() && isEnabled()) // loop until change
{
drive.tankDrive(leftStick, rightStick);
Timer.delay(0.005);
Fenrir.feed();
}
}
}




new code update
Reply With Quote