View Single Post
  #7   Spotlight this post!  
Unread 20-01-2012, 20:05
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: Digital Module not present, when it is

I have read through the naming on the pdf and don't know what I did wrong can some one tell me I.


When I load the code It reads out" Digital module 1 is present"
Here is my code

Code:
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Watchdog;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.DigitalInput;


public class RobotTemplate 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);
    Joystick doom = new Joystick(3);
    Watchdog fenrir = Watchdog.getInstance();
    Jaguar spot = new Jaguar(3);
    Jaguar rex = new Jaguar(8);
    Jaguar cooper = new Jaguar(9);
    Jaguar comet = new Jaguar(4);
    Victor Bowser = new Victor(10);
    DriverStation ds;

    public void autonomous() {
        fenrir.feed();


    }

    void clawin() {
        if (doom.getRawButton(2)) {
            spot.set(1.0);
            cooper.set(1.0);
        }
    }

    void clawout() {
        if (doom.getRawButton(3)) {
            spot.set(-1.0);


        }
    }

    void clawout2() {
        if (doom.getRawButton(3)) {
            cooper.set(-1.0);

        }

    }

    void up() {
        if (doom.getRawButton(4)) {
            spot.set(-1.0);

        }

    }

    void up2() {
        if (doom.getRawButton(4)) {


            cooper.set(1.0);
        }

    }

    void down() {
        if (doom.getRawButton(5)) {
            spot.set(1.0);

        }

    }

    void down2() {
        if (doom.getRawButton(5)) {

            cooper.set(-1.0);
        }

    }

    void stop() {
        if (doom.getRawButton(1)) {
            cooper.set(0.0);
            spot.set(0.0);

        }


    }

    void minideploy() {

        if (leftStick.getRawButton(2)) {
            Bowser.set(1.0);

        } else {
            Bowser.set(0.0);
        }
    }

    void mini() {

        if (leftStick.getRawButton(3)) {
            Bowser.set(-1.0);

        } else {
            Bowser.set(0.0);
        }

    }

    void armre() {

        if (leftStick.getRawButton(1)) {
            comet.set(-1.0);

        } else {
            comet.set(0.0);

        }
    }

    public void operatorControl() {
        while (true && isOperatorControl() && isEnabled()) {
            drive.tankDrive(leftStick, rightStick);
            down();
            down2();
            up();
            up2();
            armre();
            clawout();
            clawin();
            rex.set(doom.getY());
            stop();
            clawout2();
            minideploy();
            mini();
            fenrir.feed();
        }
    }
}

Last edited by Twisted eric : 20-01-2012 at 20:13. Reason: minor typo
Reply With Quote