Go to Post Honestly, no one at a FIRST competition is gonna judge you. Chances are, there are least 20 people dorkier than you. - JohnnyB [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

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-01-2008, 13:14
DRH2o's Avatar
DRH2o DRH2o is offline
Registered User
AKA: Dan Waters
FRC #1598 (Team Talon)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Danville, VA
Posts: 147
DRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of light
Help with automatic relay control

Forgive me if this is answered somewhere else -- I looked and could not find.

I am trying to get a relay to automatically fire forward when the analog values to a pwm are in a range around nutral. I put an if statement in with an assignment specifying the condition I want and it works, but will not change states when when the joystick is moved out of the range. I tried adding an else if statement after, I tried a while loop, no good???

Any suggestions -- I know it is something simple I am missing.

Last edited by DRH2o : 23-01-2008 at 13:21.
  #2   Spotlight this post!  
Unread 23-01-2008, 13:32
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: Help with automatic relay control

If you post your code, we can tell you what the problem is. If I understand what you are trying to do correctly, it should look a little like this:

Code:
if (pwm_val > (127 + deadband) || pwm_val < (127 - deadband))
{
relay = rev; // out of neutral condition
} else
{
relay = fwd; // in neutral condition
}

Last edited by TubaMorg : 23-01-2008 at 13:33. Reason: neurtal != neutral
  #3   Spotlight this post!  
Unread 23-01-2008, 14:43
DRH2o's Avatar
DRH2o DRH2o is offline
Registered User
AKA: Dan Waters
FRC #1598 (Team Talon)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Danville, VA
Posts: 147
DRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of light
Re: Help with automatic relay control

That is the first thing I tried, but the relay will not change from the first state it goes to.

I will try to post some code when I get to that computer. It is done in easyc though -- I might just try to put in some user code.

Thanks

Last edited by DRH2o : 23-01-2008 at 14:45. Reason: addition
  #4   Spotlight this post!  
Unread 23-01-2008, 15:11
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: Help with automatic relay control

EasyC also visualizes as straight C code so you can post that. It could also be that your joy sticks are out of trim and moving them is not taking them out of your deadband.
  #5   Spotlight this post!  
Unread 23-01-2008, 15:21
DRH2o's Avatar
DRH2o DRH2o is offline
Registered User
AKA: Dan Waters
FRC #1598 (Team Talon)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Danville, VA
Posts: 147
DRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of light
Re: Help with automatic relay control

I thought that also, so I did a print to screen and they show the value change.
  #6   Spotlight this post!  
Unread 23-01-2008, 18:13
DRH2o's Avatar
DRH2o DRH2o is offline
Registered User
AKA: Dan Waters
FRC #1598 (Team Talon)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Danville, VA
Posts: 147
DRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of lightDRH2o is a glorious beacon of light
Re: Help with automatic relay control

Dan,

Thanks for the help. I got it working. I do not know what was wrong, but I redid it ( replaced || with && ) and it works great. By the way -- this is for an automatic brake ( using a bicycle disk brake acuated pnumatically ) for our arm. I think it will work great now. Thanks !!!!

Last edited by DRH2o : 23-01-2008 at 18:14. Reason: duh !!
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
[OCCRA]: Problem with the compressor, pressure switch, or Bosch relay. BrittanyV OCCRA 3 16-10-2006 15:42
Help: IFI loader not communicating with control unit red_alert_13 Programming 9 20-01-2006 17:30
using SPIKE relay module with Fisher Price motors 1574aviad Motors 4 27-01-2005 01:49
We need help with joystick control Team ICE #1611 Control System 4 24-01-2005 15:57
NEED HELP with Delay loop for compressor relay switch archiver 2001 10 24-06-2002 02:11


All times are GMT -5. The time now is 23:11.

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