Go to Post The mission of FIRST is not just to promote science and technology, but to help every student involved to reach their full potential and achieve their dreams - Mike Ciance [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-02-2013, 15:33
e10 e10 is offline
Registered User
FRC #3949
 
Join Date: Nov 2012
Location: Brampton
Posts: 5
e10 is an unknown quantity at this point
Relays not working

We are having an issue getting our relays to work. We are using a spike relay to move a motor. We believe everything is connected correctly, as the light on the relay is on. Thus we think the problem is in our code:

Code:
class RobotDemo : public SimpleRobot
{	
	RobotDrive myRobot; // robot drive syste0m
	Relay feeder;
	
public:
	RobotDemo(void):
		feeder(5, Relay::kForwardOnly)

	void OperatorControl(void)
	{
		while (IsOperatorControl()){
			
                                     feeder.Set(Relay::kOn);	
		           feeder.Set(Relay::kForward);
		}
	}
Reply With Quote
  #2   Spotlight this post!  
Unread 14-02-2013, 16:36
Toa Circuit's Avatar
Toa Circuit Toa Circuit is offline
Thaddeus Maximus
AKA: Thad Hughes
FRC #4213 (MetalCow Robotics)
Team Role: Leadership
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Shirley, IL
Posts: 131
Toa Circuit is an unknown quantity at this point
Re: Relays not working

Get rid of the line that says
Code:
feeder.Set(Relay::kOn);
and try that.
I've never written that line ever, and all you should need is the feeder.Set(Relay::kForward);
__________________

2012 Head of Programming and Electrical
2013-14 Overall Team Captain and Programming Head
2012-14 Mentor of FLL Team Power Surge
2014 Dean's List Finalist
2014 CIR Xerox Creativity Award
Webpage
Reply With Quote
  #3   Spotlight this post!  
Unread 14-02-2013, 16:51
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,791
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Relays not working

Relay.Value has 4 values: kForward, kOff, kOn, and kReverse. These each do something specific with the relay.

kForward drives it forward - in other words, it connects M+ to your +12V input, and M- to the ground input.

kReverse drives it backwards - M+ to ground, M- to +12V.

kOff turns off the connections - it connects both M+ and M- to ground.

kOn turns on both connections - it connects both M+ and M- to +12V.

In terms of FIRST use with motors, all you really need is off, forward, and reverse. Using it with the compressor, all you need is off and forward.

However, in some low voltage situations (like pneumatic solenoid valves or LED lighting) you can run the ground wire directly into the power distribution board's ground, and run the positive wire to either of the relay outputs.

In the case of a 2-position pneumatic solenoid hooked up to a single cylinder, this means you always drive the relay forward or reverse, and the cylinder will move accordingly - setting it to off or on won't do anything.

In the case of LED lighting, this can allow you to turn on different sets of LED's - for example, forward might turn on red LED's, while reverse turns on blue ones. off would turn them both off, while on would turn them both on.
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote
  #4   Spotlight this post!  
Unread 14-02-2013, 17:49
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Relays not working

It's probably just us, but we couldn't get the relays to work unless we were using a pointer...
Code:
feeder->Set(Relay::kForward);
Reply With Quote
  #5   Spotlight this post!  
Unread 14-02-2013, 20:38
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 358
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
Re: Relays not working

You are missing the line
myRobot(1,2)
Under
RobotDemo(void):

and above
feeder(5, Relay::kForwardOnly)

That initializes the robot drive and the feeder

Code:
class RobotDemo : public SimpleRobot
{	
	RobotDrive myRobot; // robot drive syste0m
	Relay feeder;
	
public:
	RobotDemo(void):
                           myRobot(1,2),
		feeder(5, Relay::kForwardOnly)

	void OperatorControl(void)
	{
		while (IsOperatorControl()){
			
	
		           feeder.Set(Relay::kForward);
		}
	}
__________________
Brian K
Team 1225 Robotics Mentor
Reply With Quote
Reply


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 03:33.

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