Go to Post From what I've seen in FIRST, teams that copy generally always learn something from it, and if they don't, the copy they produce is of much lower quality than the original. - TheOtherGuy [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 18-02-2010, 00:47
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
Limit Switch

In java I'm trying to code a limit switch to my single motor called hunt

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;
import edu.wpi.first.wpilibj.Jaguar;

public class Pup extends SimpleRobot {

    private static final long TIME_DELAY = 1000; // in milliseconds
    RobotDrive drive = new RobotDrive(1, 2);
    Joystick leftstick = new Joystick(1);
    Joystick rightstick = new Joystick(2);
    Jaguar hunt = new Jaguar(4);
    Joystick spot = new Joystick(4);
    Joystick kicker = new Joystick(3);
    Watchdog fenrir = Watchdog.getInstance();
    Compressor fluffy = new Compressor(1, 1);

    void setUpRobot() {
        fluffy.start();
        fenrir.feed();
    }
    
    public void autonomous() {
        setUpRobot();
        fenrir.setEnabled(false);
        while (true && isAutonomous() && isEnabled()) {
            drive.drive(1.0, 0.0);  // drive 100% fwd 0% turn
        }
    }

    public void operatorControl() {
        setUpRobot();
        while (true && isOperatorControl() && isEnabled()) // loop until change
        {
            drive.tankDrive(leftstick, rightstick);
            hunt.set(kicker.getY());
            Timer.delay(0.005);
            fenrir.feed();
        }    
    }
}
but i want it so that when it hits it, it will not go that way
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
limit switch solomason519 Programming 9 09-02-2010 08:50
Limit Switch Problem Boydean Programming 3 13-02-2008 16:32
Using a limit switch to limit motion ManicMechanic Programming 16 20-12-2007 00:54
limit switch wedellm Electrical 4 16-02-2007 13:01


All times are GMT -5. The time now is 03:37.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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