hi.
I think you can use SPD command. [SPD X0 K100 D5] counts inputs in X0 during 100ms and put in to data register D5.
After that you can use [> d5 k20] . If data register d5 is greater then 20 you can switch some device on . Im using gx3 for programming. and that code works for fx5uc.