Go to Post You can't expect a situation to get better if you don't make an attempt to confront it. - AndyB [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 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
 


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


All times are GMT -5. The time now is 09:42.

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