Go to Post Team 71: So good at Strategy they already have figured out next years game before the GDC has even met. - IKE [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
  #2   Spotlight this post!  
Unread 19-02-2004, 06:50
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Getting the relays to stay constant

Do something like this:
Code:
unsigned char state = 0;
unsinged char switchState = 0;

// Check switches. Substitute switch for whatever switch on the OI you are using
// I use the switch state to prevent the switching of the state do to not realeasing the button right away
if(switch && !switchState)
{
    // Set switch state
    swtichState = 1;

    // Switch states
    if(switch)
        state = 0;
    else
        state = 1;
}
else if(!switch)
{
    // reset the switch state
    switchState = 0;
}

// Subitute relay with your relay
if(state)
{
     // Run forward
     relay_fwd = 1;
     relay_rev = 0;
}
else
{
    // Turn off relay
    relay_fwd = 0;
    relay_rev = 0;
}
Put that whole thing where ever you are doing your cheking currently. Put the varable declarations at the top of whatever function you have this in. That should work. (I hope... )
__________________

 


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
stay on the carpet????!!!! soap108 Rules/Strategy 12 13-03-2003 12:50
SPIKE relays Andy Brockway Electrical 2 13-11-2002 13:22
where are teams going to stay? archiver 2001 2 24-06-2002 02:49
How many hotels did you team stay at?? Elgin Clock Championship Event 4 10-05-2002 17:53
How do you control relays BinaryBob0001 Technical Discussion 2 21-01-2002 08:42


All times are GMT -5. The time now is 18:22.

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