View Single Post
  #2   Spotlight this post!  
Unread 30-05-2007, 21:24
IraJason IraJason is offline
In Search of "Bang Head Here" Sign
AKA: Ira Goldberg
FRC #3632 (D-Tecs); FRC #1712 (Dawgma)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2005
Location: Lower Merion, PA
Posts: 283
IraJason has a brilliant futureIraJason has a brilliant futureIraJason has a brilliant futureIraJason has a brilliant futureIraJason has a brilliant futureIraJason has a brilliant futureIraJason has a brilliant futureIraJason has a brilliant futureIraJason has a brilliant futureIraJason has a brilliant futureIraJason has a brilliant future
Send a message via AIM to IraJason Send a message via MSN to IraJason
Re: Single Click On/Off Using the Trigger in EasyC

Quote:
Originally Posted by bear24rw View Post
This how we did a click on click off
Code:
    if(CLAW_BUTTON == 1 && claw_toggle_state == 0)       // Code to handle toggle
    {
        CLAW_OPEN = !CLAW_OPEN;
        CLAW_CLOSED = !CLAW_CLOSED;
    }

    claw_toggle_state = CLAW_BUTTON;
It has been a few months since I've done computer programming, so from what I'm getting now, if the button is pressed and the claw_toggle_state = 0, and CLAW_OPEN and CLAW_CLOSED becomes not what it's previous state was. The claw_toggle_state then becomes 1 when it is pressed.

This means in my code I should have:
Code:
if(p1_sw_trig && cathode_toggle_state == 0)
{
    OItoRelay(1,1,1,1);
}

cathode_toggle_state = p1_sw_trig;
I think that should be right, but feel free to correct me.
__________________
Many respectable physicists said that they weren't going to stand for this - partly because it was a debasement of science, but mostly because they didn't get invited to those sort of parties."
-Douglas Adams The Hitchhiker's Guide to the Galaxy

2007 Galileo #6 seed, 5th Alliance Captain, Semi-finalist
2007 Philly Regional #4 Seed, Philly Regional GM Industrial Design Award Winner
2006 Philly Regional Highest Rookie Seed,Philly Regional Rookie All Star