user26915: I'm trying to have a keypad do two one of three things when a key is pressed: 

If the 1 is pressed I want LED 1 to blink twice then stay on
If either the 2 or the 3 is pressed I want LED 2 to blink forever
If the # key is pressed I want it to cancel whatever's going on with the other LEDs

How can I use millis() to blink forever? Or just blink twice then stay on? When in my blinking should I be checking for another keypress? What's frustrating me is that I know how to do all this with delay(), and I've written 70% of the code for it with delay, but if I use delay I don't think it'll be able to check for another key input, will it?
Thanks for any help.

user7508: 
How can I use millis() to blink forever?

The algorithm is essentially as follows:
if (it_is_time_to_toggle_the_led()) {
    toggle_the_led();
}

The details are thoroughly covered in the Blink Without Delay
Arduino tutorial. It is essential to understand this technique: as soon
as you have more than one thing to do in your program (here: blink an
LED and monitor button presses), delay() is toxic because it blocks
all the program. You should really ban delay() from your vocabulary,
except for the simpler single-task programs.

Or just blink twice then stay on?

For this and your other questions, the canonical answer is “implement a
finite state machine”. I recommend the Finite State Machine
tutorial[] by Majenko.
In this particular instance, I would probably implement two FSMs, one
for each LED. The first one would have three states: (OFF, BLINKING,
ON), and a counter for the number of blinks. The transition rules:

If button 1 is pressed and the state is not BLINKING go to the
BLINKING state
If it is BLINKING and it's time for it to toggle, do it
If it is BLINKING and it is switching on for the third time, go to
the ON state
If '#' has been pressed, go to the OFF state.

Or maybe you could split the state BLINKING into BLINKING_ON and
BLINKING_OFF.
The second LED would be essentially the same, except for lacking the ON
state and rule number 3.
I am not writing the code, but you may want to take a look at this code
for automatic door[]. It is an answer to a seemingly unrelated
question, but it gives a good example on how to combine millis()-based
timing with a finite state machine. Your program could be written mostly
along the same lines.

26915: <p>I'm trying to have a keypad do two one of three things when a key is pressed: </p>

<ol>
<li>If the 1 is pressed I want LED 1 to blink twice then stay on</li>
<li>If either the 2 or the 3 is pressed I want LED 2 to blink forever</li>
<li>If the # key is pressed I want it to cancel whatever's going on with the other LEDs</li>
</ol>

<p>How can I use <code>millis()</code> to blink forever? Or just blink twice then stay on? When in my blinking should I be checking for another keypress? What's frustrating me is that I know how to do all this with <code>delay()</code>, and I've written 70% of the code for it with delay, but if I use delay I don't think it'll be able to check for another key input, will it?</p>

<p>Thanks for any help.</p>
 7508: <blockquote>
  <p>How can I use <code>millis()</code> to blink forever?</p>
</blockquote>

<p>The algorithm is essentially as follows:</p>

<pre><code>if (it_is_time_to_toggle_the_led()) {
    toggle_the_led();
}
</code></pre>

<p>The details are thoroughly covered in the <a href="https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay" rel="nofollow noreferrer">Blink Without Delay</a>
Arduino tutorial. It is essential to understand this technique: as soon
as you have more than one thing to do in your program (here: blink an
LED and monitor button presses), <code>delay()</code> is toxic because it blocks
<em>all</em> the program. You should really ban <code>delay()</code> from your vocabulary,
except for the simpler single-task programs.</p>

<blockquote>
  <p>Or just blink twice then stay on?</p>
</blockquote>

<p>For this and your other questions, the canonical answer is “implement a
<a href="https://en.wikipedia.org/wiki/Finite-state_machine" rel="nofollow noreferrer">finite state machine</a>”. I recommend the <a href="https://hackingmajenkoblog.wordpress.com/2016/02/01/the-finite-state-machine/" rel="nofollow noreferrer">Finite State Machine
tutorial</a>[] by Majenko.</p>

<p>In this particular instance, I would probably implement <em>two</em> FSMs, one
for each LED. The first one would have three states: (OFF, BLINKING,
ON), and a counter for the number of blinks. The transition rules:</p>

<ol>
<li>If button 1 is pressed and the state is not BLINKING go to the
BLINKING state</li>
<li>If it is BLINKING and it's time for it to toggle, do it</li>
<li>If it is BLINKING and it is switching on for the third time, go to
the ON state</li>
<li>If '#' has been pressed, go to the OFF state.</li>
</ol>

<p>Or maybe you could split the state BLINKING into BLINKING_ON and
BLINKING_OFF.</p>

<p>The second LED would be essentially the same, except for lacking the ON
state and rule number 3.</p>

<p>I am not writing the code, but you may want to take a look at this <a href="https://arduino.stackexchange.com/a/29137">code
for automatic door</a>[]. It is an answer to a seemingly unrelated
question, but it gives a good example on how to combine <code>millis()</code>-based
timing with a finite state machine. Your program could be written mostly
along the same lines.</p>
