Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Help 2 hours help (http://www.chiefdelphi.com/forums/showthread.php?t=103545)

DBortnick 21-02-2012 20:35

Help 2 hours help
 
We have to know how to get the spike to run both directions right now we only have it set to run one direction we have tried everything please help

Code:

#include "../Robotmap.h"

Sweeper::Sweeper() : Subsystem("Sweeper") {
        relay = new Relay(SWEEPER_RELAY, Relay::kBothDirections);
        isIn = true;
        isOn = true;
}
   
// No default command defined for Conveyor.
void Sweeper::InitDefaultCommand() {}

// Start running the instance with the current state
void Sweeper::run() {
        if( isOn ) {
                if( isIn ) {
                        relay->Set(Relay::kForward);
                }
                else {
                        relay->Set(Relay::kReverse);
                }
        }
        else {
                relay->Set(Relay::kOff);

Code:

#ifndef SWEEPER_H
#define SWEEPER_H
#include "Commands/Subsystem.h"
#include "WPILib.h"

/*
 * Interface for Sweeper that will take balls from the floor into robot.
 *
 * Hardware:
 *  - Relay
 * States:
 *  - on/off
 *  - balls going in/out
 * Driver control:
 *  - two buttons on joystick that toggle its states. 
 */

class Sweeper: public Subsystem {
private:
        Relay *relay;
        bool  isOn;
        bool  isIn;
public:
        Sweeper();
        void toggleOnOffState() { isOn = !isOn; }               
        void toggleInOutState(){ isIn = !isIn; }       
        void run();                                                                        // run Conveyor based on current state
        void InitDefaultCommand();                                       
};

#endif



All times are GMT -5. The time now is 00:52.

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