user7852: I have a functionality on my mega 2560 to connect with other devices. Sometimes, devices can't answer. I don't want to wait for a longwhile. So, how can I interrupt the chunk of program after the specific amount of time? 
My code for receiving messages is:
while (!(UCSR1A & (1<<RXC1)));

so, millis can't solve my problem because I haven't ability to check for conditional loops like that
if(currentMillis - previousMillis > interval) {


user7852: OMG, I was stupid. I can just place millis in this while condition.

7852: <p>I have a functionality on my mega 2560 to connect with other devices. Sometimes, devices can't answer. I don't want to wait for a longwhile. So, how can I interrupt the chunk of program after the specific amount of time? </p>

<p>My code for receiving messages is:</p>

<pre><code>while (!(UCSR1A &amp; (1&lt;&lt;RXC1)));
</code></pre>

<p>so, <code>millis</code> can't solve my problem because I haven't ability to check for conditional loops like that</p>

<pre><code>if(currentMillis - previousMillis &gt; interval) {
</code></pre>
 7852: <p>OMG, I was stupid. I can just place millis in this <code>while</code> condition.</p>
