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.