View Single Post
  #1   Spotlight this post!  
Unread 30-05-2007, 20:36
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
Single Click On/Off Using the Trigger in EasyC

I've posted a few pictures of my senior project, and before my presentation I've been working with Easy C to get the cathodes that are attached to my robot to light up and stay lit after a single click of the left trigger. I then wanted the cathodes to turn off once the trigger was clicked again. The cathodes are connected to the RC using a Spike Relay. I have been using EasyC to program my robot. I do not have the laptop that is used for programing with me but I believe my current code is:

if(p1_sw_trig && n == 0)
{
OItoRelay(1,1,1,1);
n = 1;
}

if(p1_sw_trig && n == 1)
{
n = 0;
}

This turns the light on with a single button click, but the cathodes do not always turn off with the next click. I was wondering if anyone knew how to make this work, rather than have it work half the time or using two buttons to turn it on and off. Thanks in advance!

-Ira
__________________
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