View Single Post
  #1   Spotlight this post!  
Unread 21-02-2012, 20:35
DBortnick's Avatar
DBortnick DBortnick is offline
Registered User
AKA: Daniel
FRC #1850 (Mechanicats)
Team Role: Coach
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Chicago, IL
Posts: 42
DBortnick is on a distinguished road
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
__________________
Coach for Team 1850
ACE Technical Mechanicats - Chicago, IL

http://www.facebook.com/Team1850