I hate to ask a dumb question, but I still wonder why I have to resort to trig in order to solve this problem.
What I mean, is this is pretty low frequency stuff (25hz), and square wave, with the time on high, the same as the time on low, and very consistent for about 2 seconds.
Couldn't I just sample the input voltage on the analog pin say 50 times a second, looking for a high, then fast drop to low. If the arduino sees that, it would wait 40 milliseconds (or maybe keep taking samples to make sure its a flat wave), and then see if the voltage goes back up to the same level (or pretty close) as the first high. If it doesn't see this the frequency is wrong, it dumps the subroutine, and starts from the beginning.
If it does the arduino would look for the same thing on the low voltage (40ms of low, followed by a sudden spike of high). The arduino could keep doing this for several cycles to make sure it was a generated pulse and not random noise.
I am pretty sure I am missing something big that is a real show stopper, or that I am overlooking something important, but I can't see what it is.
A little off topic, but one of the reasons I want to do this in software is that someday I would love to create my own subaudible tones, but instead of having 25hz of high and low evenly spaced, I could alter the highs and lows somewhat. If the arduino could catch the first 8 pules of a subaudible tone, and knew the frequency I could use the next 4 pules to send a binary code out. Giving my single 25hz tone the ability to make up to 15 different closures. Perhaps I am just asking too much.