View Single Post
  #15   Spotlight this post!  
Unread 01-06-2007, 00:29
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Single Click On/Off Using the Trigger in EasyC

Even though I'm not a C programmer, I've done this with my TI-89 before when making a program...

It would be something like this I guess
Code:
//NOTE: THIS IS NOT C CODING AT ALL AND IF YOU USE THIS, YOU WILL GET ERRORS!!!
define lastvalue //lastvalue can be any variable
 define cathodespike //this would be replaced by the particular spike you will have set to control your cathode

do:
if lastvalue==(not equal)p1_sw_trig and p1_sw_trig=1 cathodespike=1 then
   cathodespike=0
   lastvalue = 1
endif
if lastvalue==(not equal)p1_sw_trig and p1_sw_trig=1 and cathodespike=0 then
cathodespike=1
lastvalue = 1
endif
lastvalue = p1_sw_trig
loop
With this code, there is no delay and no chance of the light blinking on and off if the trigger is held in a closed state.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364

Last edited by RyanN : 01-06-2007 at 14:34. Reason: Forgot my loop statement :D