user2793: I'm trying to build almost exactly this device: 
http://www.reuk.co.uk/wordpress/reuk-shop-low-voltage-disconnects-lvd/buy-reuk-programmable-low-voltage-disconnect-with-display/
It is a low voltage disconnect but has an interesting feature that requires the "cutoff" and "reconnect" voltages to be reached for 10 seconds before the connection is actually cut/re-connected to prevent premature status changes from voltage spikes/sags (Such as starting a car, or a motor with high start draw) 
I need some example code that handles the timer portion. I can handle the "if this voltage is reached, disconnect the relay" (or transistor in the link I provided) part. 
I need help making it "If this voltage has reached XX for 10 seconds then -do something-" 

user16085: Assuming you have a function voltageIsReached(), here's a very simple way of doing it, which is OK if you don't have anything else to do in the mean time.
if (voltageIsReached()) {
    long end = millis() + 10000;   // 10s from now
    boolean voltageWasReachedFor10s = false;
    while (voltageIsReached()) {
        if (millis() >= end) {   
            voltageWasReachedFor10s = true;
            break;
        }
        delay(1);
    }
    if (voltageWasReachedFor10s) {
        // Do whatever you have to do
    }
}

If you do have something else to do while you're waiting for this 10s state, you will need to adapt this, but I hope it'll get you started.

2793: <p>I'm trying to build almost exactly this device: </p>

<p><a href="http://www.reuk.co.uk/wordpress/reuk-shop-low-voltage-disconnects-lvd/buy-reuk-programmable-low-voltage-disconnect-with-display/" rel="nofollow noreferrer">http://www.reuk.co.uk/wordpress/reuk-shop-low-voltage-disconnects-lvd/buy-reuk-programmable-low-voltage-disconnect-with-display/</a></p>

<p>It is a low voltage disconnect but has an interesting feature that requires the "cutoff" and "reconnect" voltages to be reached for 10 seconds before the connection is actually cut/re-connected to prevent premature status changes from voltage spikes/sags (Such as starting a car, or a motor with high start draw) </p>

<p>I need some example code that handles the timer portion. I can handle the "if this voltage is reached, disconnect the relay" (or transistor in the link I provided) part. </p>

<p>I need help making it "If this voltage has reached XX for 10 seconds then -do something-" </p>
 16085: <p>Assuming you have a function <code>voltageIsReached()</code>, here's a very simple way of doing it, which is OK if you don't have anything else to do in the mean time.</p>

<pre><code>if (voltageIsReached()) {
    long end = millis() + 10000;   // 10s from now
    boolean voltageWasReachedFor10s = false;
    while (voltageIsReached()) {
        if (millis() &gt;= end) {   
            voltageWasReachedFor10s = true;
            break;
        }
        delay(1);
    }
    if (voltageWasReachedFor10s) {
        // Do whatever you have to do
    }
}
</code></pre>

<p>If you <em>do</em> have something else to do while you're waiting for this 10s state, you will need to adapt this, but I hope it'll get you started.</p>
